Introduction
MIME (Multipurpose Internet Mail Extensions) encoding, defined in RFC 2045, allows email headers to contain non-ASCII text. Without it, subject lines with accented characters, CJK text, or emoji would break SMTP. The encoded-word format =?charset?encoding?text?= is ubiquitous in email infrastructure. If you debug email headers, parse bounce messages, or build mail clients, this tool encodes and decodes MIME encoded-words instantly in your browser.
What this tool does
- Encodes text into MIME encoded-word format (=?UTF-8?B?...?= or =?UTF-8?Q?...?=)
- Decodes MIME encoded-words back to readable text
- Supports both Base64 (B) and Quoted-Printable (Q) encoding variants
- Wraps long encoded words at 76 characters per RFC 2045
- Handles multi-line encoded-words (folded headers)
How this tool works
In encode mode, the tool takes input text and converts it to UTF-8 bytes. For Base64 encoding, it produces =?UTF-8?B?
How MIME encoded-word encoding works
RFC 2045 section 2 defines the encoded-word representation for non-ASCII text in message headers. The format is =?charset?encoding?encoded_text?= where charset is a registered character set (UTF-8, ISO-8859-1, etc.), encoding is B (Base64) or Q (Quoted-Printable), and encoded_text is the result. RFC 2047 extends this with rules for splitting long encoded-words across multiple lines. Base64 encoding is simpler and more compact for binary-heavy text. Q encoding is more readable for mostly-ASCII text with a few non-ASCII characters, since ASCII characters pass through unchanged except for spaces (which become underscores) and the characters ?, =, and _ (which are hex-encoded). The 76-character line length limit comes from RFC 5322's header folding rules.
How to use this tool
- Select mode: Encode or Decode.
- For encoding: choose Base64 (B) or Quoted-Printable (Q) encoding.
- Type or paste text in the input box. The encoded or decoded result appears instantly.
- Use the Swap button to switch between encode and decode modes.
- Copy the output using the Copy result button.
Real-world examples
Encoding a non-ASCII subject line
Input: "Cafe Menu - Prices in Euros (EUR)". With Base64 encoding, the output is =?UTF-8?B?Q2FmZSBNZW51IC0gUHJpY2VzIGluIEV1cm9zIChFVVIp?=. This is what mail clients place in the Subject: header when the text contains non-ASCII characters.
Decoding a bounce message header
A bounce notification contains Subject: =?UTF-8?Q?R=C3=A9ception_de_votre_message?=. Paste this into decode mode to get "Reception de votre message" (with the accented e). This is useful when debugging email delivery issues with international recipients.
Handling CJK subject lines
Japanese subject line "Meeting Confirmation" in Japanese encodes to =?UTF-8?B?5pSv5oCl44Gu5L+h5Yqo?=. The Base64 variant is preferred for CJK text because Q encoding would hex-encode nearly every byte, making the header unreadable and longer than Base64.
Comparison with similar methods
| Method | Complexity | Typical use |
|---|---|---|
| MIME Base64 (B) | Base64 encode + charset tag | Non-ASCII headers, CJK text |
| MIME Q encoding | QP encode + underscore for spaces | Mostly-ASCII with few non-ASCII |
| RFC 2231 | Parameter-specific encoding | Content-Disposition filenames |
Limitations or considerations
The tool handles the encoded-word format defined in RFC 2047. It does not handle RFC 2231 parameter continuations (used in Content-Disposition filenames) or raw MIME body parts (used in multipart messages). For MIME body encoding, use the Quoted-Printable Encoder/Decoder tool. The decoder preserves text outside encoded-words, which is correct for most real-world headers but may produce unexpected results if the input contains literal =? sequences that are not encoded-words.
Frequently asked questions
What is the difference between B and Q encoding in MIME?
B encoding (Base64) encodes the entire text as base64, which is compact for binary-heavy text like CJK. Q encoding (Quoted-Printable) leaves ASCII characters unchanged and only hex-encodes non-ASCII bytes, which is more readable for mostly-ASCII text with a few accented characters.
Why do email subjects show as =?UTF-8?B?...?= in raw headers?
This is the encoded-word format from RFC 2047. Mail clients decode it before display. If you see the raw encoding in your mail client, it means the client failed to decode it, which usually indicates a malformed encoded-word.
How long can an encoded-word be?
RFC 2047 limits each encoded-word to 75 characters. Longer text is split into multiple encoded-words separated by whitespace. The tool wraps automatically at 76 characters, which accounts for the =?charset?encoding? prefix.
Can this tool decode RFC 2231 filename parameters?
No. RFC 2231 uses a different format for Content-Disposition parameters (filename*=UTF-8''...). This tool specifically handles RFC 2047 encoded-words in headers like Subject:, From:, and To:.
Conclusion
MIME encoded-word encoding is fundamental to email infrastructure. This tool handles both Base64 (B) and Quoted-Printable (Q) variants for encoding and decoding. Use it when debugging email headers, building mail clients, or verifying that your mail server produces correct encoded-words for international recipients.