A quoted-printable decoder turns =XX escape sequences back into the bytes they stand for, and removes the soft line breaks that email software inserts to keep lines short.
Example
Caf=C3=A9 au lait =E2=80=93 =E2=82=AC3.50Café au lait – €3.50=C3=A9 is the two UTF-8 bytes of é, =E2=80=93 is an en dash and =E2=82=AC is the euro sign.
What is quoted-printable?
Quoted-printable is a MIME content transfer encoding defined in RFC 2045. Email was designed for 7-bit ASCII with short lines, so any byte that isn't plain printable ASCII has to be escaped. Quoted-printable writes such a byte as = followed by two hex digits. Everything else is left alone, so mostly-English text stays readable even before decoding. That is the main difference from Base64, which makes the whole body unreadable.
Lines are limited to 76 characters. To wrap a long line without changing the content, the encoder ends it with a lone =, called a soft line break. The decoder joins those lines back together.
You will meet quoted-printable in raw email source (Content-Transfer-Encoding: quoted-printable), in .eml files and in mail server logs. A related format, the "Q" encoding of RFC 2047, appears in headers as =?UTF-8?Q?Caf=C3=A9?=. Inside the ?Q? part, _ stands for a space.
How to use the quoted-printable decoder
- Paste the encoded body, including any lines ending in
=. - Read the decoded text.
- For an encoded header like
=?UTF-8?Q?…?=, paste only the part between?Q?and?=, and replace_with spaces.
Decode quoted-printable in code
import quopri
print(quopri.decodestring("Caf=C3=A9 au lait =E2=80=93 =E2=82=AC3.50").decode("utf-8"))Quoted-printable at a glance
| Specification | RFC 2045 (MIME), headers in RFC 2047 |
| Escape format | = plus two hex digits, for example =3D for = |
| Soft line break | = at the end of a line |
| Maximum line length | 76 characters |
Frequently asked questions
Why is there an = at the end of lines in my email?
That is a soft line break. The encoder wraps long lines at 76 characters and marks each wrap with = so the decoder knows to join the lines back together.
What does =3D mean?
It is an escaped equals sign. Because = starts every escape, a literal = in the original text has to be written as =3D.
Quoted-printable or Base64: how does email choose?
Mail software usually picks quoted-printable for text that is mostly ASCII, because it stays readable and small, and Base64 for binary attachments or text that is mostly non-ASCII.
Last reviewed · found a mistake? contact@decoder.tools · view as markdown