RFC 2047 Q-encoding is how non-ASCII text — accented names, emoji, other scripts — is safely placed in email headers such as Subject and From. It wraps the text in an encoded-word: =?UTF-8?Q?...?=. This tool encodes and decodes Q encoded-words in your browser.
How it works
The encoded-word format is =?charset?encoding?encoded-text?=. For the Q encoding:
- The text is first converted to UTF-8 bytes with
TextEncoder. - Printable ASCII bytes pass through unchanged, except that space becomes
_, and=,?, and_are always escaped because they are structural. - Every other byte (any byte over 0x7E, control characters, and the escaped ones) becomes
=followed by two uppercase hex digits — for exampleé(UTF-80xC3 0xA9) becomes=C3=A9. - The result is wrapped as
=?UTF-8?Q?...?=.
Decoding reverses this: it reads the charset and Q marker, turns _ back into a space, and converts each =XX back into its byte before UTF-8 decoding.
Tips and examples
The subject Café encodes to =?UTF-8?Q?Caf=C3=A9?=. A space-separated phrase like Re: déjà vu becomes =?UTF-8?Q?Re=3A_d=C3=A9j=C3=A0_vu?= — note the ?-equivalent colon escaping and the underscore for the space. Keep each encoded-word under 75 characters; the tool warns you when a value is long enough that a real mail client would need to split it across multiple encoded-words.