RFC 2047: MIME Part Three: Message Header Extensions for Non-ASCII Text

Defines encoded-word syntax for non-ASCII characters in headers.
Alaa
By Alaa
SMTPedia documents email infrastructure end to end: SMTP standards from the RFC archive, delivera...
8 min read Updated Jul 22, 2026 174 views
RFC 2047
MIME Part Three: Message Header Extensions for Non-ASCII Text
Current standard
Domain
MIME
Published
November 1996
Supersedes
First in series
SMTP relevance
high
↗ Read on rfc-editor.org

What this RFC defines

RFC 2047 defines how non-ASCII characters can appear in email message headers. It introduces the encoded-word syntax (=?charset?encoding?text?=) that allows any Unicode character to be represented in a From:, Subject:, or other header field, even though the underlying SMTP protocol is 7-bit ASCII.

Where you see it in practice

When you receive an email with a Subject: that contains accented characters, emoji, or Chinese text, the encoded-word format from RFC 2047 is what made it possible to transit SMTP safely. A subject line like =?UTF-8?B?SGVsbG8gV29ybGQ=?= decodes to “Hello World” in base64 UTF-8. Email clients that incorrectly decode RFC 2047 headers display garbled characters in subject lines.

How it connects to other RFCs

RFC 2047 is part of the MIME suite. RFC 2231 extends RFC 2047’s approach to handle non-ASCII characters in Content-Type and Content-Disposition parameter values (like filenames). RFC 6532 provides a more modern approach for internationalized email that avoids encoded-words entirely by allowing native UTF-8 in headers.

Current status

RFC 2047 is a current standard, published November 1996. It remains widely deployed despite being considered verbose by modern standards. RFC 6532 provides a cleaner alternative for systems that support internationalized email end-to-end.

Encoded-word syntax

RFC 2047 defines how to encode non-ASCII characters in RFC 5322 header fields. The syntax is =?charset?encoding?data?= where charset is a MIME character set name (UTF-8, ISO-8859-1), encoding is Q (quoted-printable-like) or B (Base64), and data is the encoded bytes. A subject like “Café” in UTF-8 becomes =?UTF-8?Q?Caf=C3=A9?= or =?UTF-8?B?Q2Fmw6k=?=. This allows the message headers to remain 7-bit-ASCII while representing text in any language.

Where encoded-words appear

Encoded-words are permitted in From, To, Cc, Bcc, Reply-To display names, in the Subject header, and in comments and phrase text of structured headers. They are not permitted in the domain part of email addresses (that requires RFC 6531 SMTPUTF8), in Content-Type parameter values (that requires RFC 2231), or in unstructured headers like Received. Placement rules are subtle enough that many email libraries misplace encoded-words and produce headers that valid parsers reject. If a Subject looks like =?UTF-8?B?…?= raw text in an inbox, that means the client failed to decode.

Modern alternatives

RFC 2047 was designed for a 7-bit ASCII world. Since RFC 6532 (2012), internationalized email headers can carry UTF-8 directly when both endpoints support SMTPUTF8. In practice, however, RFC 2047 encoded-words remain the dominant mechanism because they work with any transport, while raw UTF-8 headers require full RFC 6531 support end-to-end. Any email library that generates outbound mail should still produce RFC 2047 encoded-words for non-ASCII header values, falling back gracefully rather than assuming UTF-8 support.

Quick Reference

RFC 2047 (November 1996) defines the encoded-word syntax: how to embed non-ASCII characters in email headers when the transport is 7-bit only. Format: =?charset?encoding?encoded-text?=. Two encodings: B (base64) and Q (quoted-printable). Enables Subject lines, display names, and other header values to carry UTF-8, Latin-1, Japanese, and any charset content while remaining 7-bit safe. Alternative to RFC 6532 UTF-8 direct (which requires SMTPUTF8 negotiation). Universally supported; still emitted by most mail generators for compatibility.

RFC 2047 at a glance

AspectDetail
PurposeEmbed non-ASCII characters in email headers via 7-bit safe encoding
Format=?charset?encoding?encoded-text?=
EncodingsB (base64) or Q (quoted-printable variant)
Alternative for SMTPUTF8 pathsRFC 6532 UTF-8 direct
Where usedSubject, From/To display names, comments, other unstructured header values
Not allowed inaddr-spec (email addresses), Message-ID, Received, dates
PublishedNovember 1996

Encoded-word syntax breakdown

RFC 2047 encoded-word structure =?charset?encoding?encoded-text?=Components: =? Start marker charset Character set of the original text (utf-8, iso-8859-1, shift_jis, etc.) ? Separator encoding B (base64) or Q (quoted-printable variant) ? Separator encoded-text Encoded representation of original text ?= End markerExample (base64): =?utf-8?B?SGVsbG8sIOS4lueVjA==?= Decodes to: “Hello, 世界”Example (Q encoding): =?utf-8?Q?Hello,_=E4=B8=96=E7=95=8C?= Decodes to: “Hello, 世界”Q encoding rules (differ slightly from body quoted-printable): Underscore (_) represents space = starts hex escape: =XX where XX is hex byte value ? and _ and = must always be encoded Other printable ASCII may appear literally

B vs Q encoding: choosing between them

AspectB (base64)Q (quoted-printable)
Overhead~33% fixedVariable; less for mostly-ASCII, more for heavy non-ASCII
Human readabilityOpaque (base64)Partial (ASCII characters visible)
Best forHeavily non-ASCII content (Asian scripts, Cyrillic)Mostly-ASCII with occasional non-ASCII (Latin extended)
Example content typeChinese, Japanese, Arabic Subject linesFrench, German, Spanish Subject lines

Placement and combination rules

Encoded-words are not universally allowed. RFC 2047 restricts placement: they can appear in unstructured text (Subject, Comments), in phrases (display name in From/To), and in comments within structured headers. They CANNOT appear inside addr-spec (the actual email address), Message-ID, Received, or other machine-parsed structured content. Encoded-words in an email address would break parsing entirely.

Header examples with encoded-word

RFC 2047 in practice: multiple encoded-words per header Original headers (UTF-8): Subject: 田中さんへ – 会議の資料 From: 山田太郎 <yamada@example.jp> To: 田中花子 <tanaka@example.jp>RFC 2047 encoded (7-bit safe): Subject: =?utf-8?B?55Sw5Lit44GV44KT44G4?= – =?utf-8?B?5Lya6K2w44Gu6LOH5paZ?= From: =?utf-8?B?5bGx55Sw5aSq6YOO?= <yamada@example.jp> To: =?utf-8?B?55Sw5Lit6Iqx5a2Q?= <tanaka@example.jp>Notes: – Email addresses stay ASCII (yamada@example.jp) – Only display names use encoded-word – Multiple encoded-words per header allowed (Subject example) – Whitespace between encoded-words is preserved (literal ASCII) – Whitespace inside encoded-word must be _ (underscore) or =20 in Q

Common encoded-word mistakes

Placing encoded-word inside an email address. Encoded-words are illegal in addr-spec. =?utf-8?B?dXNlcg==?=@example.com is malformed; the parser sees =?utf-8?B?dXNlcg==?= as a local-part, which fails validation. For non-ASCII local-parts, use SMTPUTF8; there is no encoded-word alternative for addresses.
Exceeding 75 characters per encoded-word. RFC 2047 limits each encoded-word to 75 characters. Longer values must be split into multiple encoded-words separated by folding whitespace (CRLF + space or tab). Many generators emit oversize encoded-words; strict parsers reject.
Mixing charsets within one header without breaks. Adjacent encoded-words with different charsets are legal but confusing. Some parsers get charset boundaries wrong when encoded-words are adjacent without literal ASCII between them. Prefer consistent charset per header; separate different-charset segments with literal whitespace.
Not decoding recursively. Some tools decode one layer of encoded-word and stop, missing that the decoded output can itself contain more encoded-word (rare but legal). Decoders should loop until no encoded-word markers remain in the output.
Using encoded-word in body content. Encoded-word is a header-only mechanism. Body content uses MIME Content-Transfer-Encoding (base64, quoted-printable) declared per part. Emitting encoded-word in body is meaningless; parsers do not decode it. For non-ASCII body content, use the appropriate Content-Type charset and Content-Transfer-Encoding per RFC 2045.
MIME family RFCs
  • RFC 2045: MIME base headers
  • RFC 2046: Media types and multipart structure
  • RFC 2048: Registration procedures
  • RFC 2049: Conformance criteria
  • RFC 2231: MIME parameter value extensions (percent-encoded parameters, more expressive than encoded-word for parameters)
Internationalization alternative
  • RFC 6531: SMTPUTF8 (native UTF-8 transport, alternative to encoded-word)
  • RFC 6532: Internationalized headers (UTF-8 direct in headers)
  • RFC 5322: Message Format (where encoded-word is placed)
SMTPedia companion guides

Frequently asked questions

Should I still use encoded-word in 2026 or move to RFC 6532 UTF-8 direct?

Both remain valid. Encoded-word is universally supported and works over any 7-bit or 8-bit path. RFC 6532 UTF-8 direct requires SMTPUTF8 negotiation. Modern mail libraries typically emit encoded-word for maximum compatibility while accepting either form inbound. If your entire path (sender + relays + receiver) supports SMTPUTF8, UTF-8 direct is cleaner; otherwise encoded-word remains the safe choice.

Why does Q encoding use underscore for space?

Historical shortening: quoted-printable’s =20 for space would triple the size of headers full of spaces (typical for display names and Subject lines). Underscore is defined as space in Q encoding specifically to keep encoded headers readable and compact. This means literal underscores in original text must be encoded as =5F in Q encoding; a common mistake is to emit literal underscore for a real underscore character.

Can encoded-word contain multiple charsets in one header?

Yes; each encoded-word declares its own charset. Adjacent encoded-words with different charsets are legal. However, some parsers handle transitions imperfectly, so consistent charset per header is safer. If you must mix (e.g., Japanese subject with embedded Latin quote), separate the different-charset segments with literal ASCII whitespace to help parsers.

What is the maximum length of an encoded-word?

75 characters total including the =?...?= markers. For longer content, split into multiple encoded-words separated by folding whitespace (CRLF followed by tab or space). Splitting must fall on charset boundaries (not mid-character in the original text). Most libraries handle this automatically; hand-written encoded-word generation frequently exceeds the limit and produces messages that strict parsers reject.

Can I use encoded-word in the local-part of an email address?

No. RFC 2047 explicitly prohibits encoded-word inside addr-spec. For non-ASCII local-parts, use SMTPUTF8 with UTF-8 addresses directly. For legacy 7-bit-only paths, there is no way to represent non-ASCII local-parts; delivery fails or requires ASCII aliases. For the domain part, use IDNA Punycode encoding (xn-- ASCII form).


About the Author

Alaa - SMTPedia author

Alaa · LinkedIn

Email infrastructure specialist with 8+ years of hands-on experience in SMTP, deliverability, and email verification. I’ve configured and troubleshot mail systems across Postfix, Exchange, and cloud relays, managed IP reputation and warmup campaigns, and built verification pipelines processing millions of addresses. My work spans DNS authentication (SPF, DKIM, DMARC, BIMI), bounce handling, blocklist monitoring, and compliance frameworks including CAN-SPAM and GDPR. I write every article on SMTPedia to give email professionals, developers, and marketers the accurate, RFC-grounded reference they need.


About SMTPedia

SMTPedia is an independent email industry reference covering SMTP, IMAP, POP3, email deliverability, marketing platforms, DNS authentication, and email verification. Every article is researched from official provider documentation, IETF RFCs, and industry best practices. Settings and configurations are verified quarterly.

We are cited as a source by ChatGPT, Microsoft Copilot, and thousands of email professionals worldwide. Learn more about our editorial process.