Last updated
Quoted-Printable Quick Reference
- Escape character: = (equals sign)
- Non-ASCII encoding: =XX where XX is the hex byte value
- Equals sign literal: =3D
- Space (trailing): =20
- Tab (trailing): =09
- Soft line break: = at end of line (line continues)
- Hard line break: CRLF (=0D=0A) or just LF (=0A)
- Maximum line length: 76 characters (including the trailing =)
- Best for: Content that is mostly ASCII with occasional non-ASCII characters
- Alternative: Base64 encoding (better for binary or mostly non-ASCII content)
Examples
Example 1: Basic Encoding of Non-ASCII Characters
Input text:
Café au lait costs €3.50
Quoted-printable encoded:
Caf=C3=A9 au lait costs =E2=82=AC3.50
Encoding breakdown:
é → =C3=A9 (UTF-8: 0xC3 0xA9)
€ → =E2=82=AC (UTF-8: 0xE2 0x82 0xAC)
ASCII characters (C, a, f, space, etc.) pass through unchanged.
Example 2: Encoding with Line Length Wrapping
Input (long line):
This is a very long line that contains some non-ASCII characters like é and ü and ö and needs to be wrapped at 76 characters.
Quoted-printable encoded (76-char line limit):
This is a very long line that contains some non-ASCII characters like =C3=
=A9 and =C3=BC and =C3=B6 and needs to be wrapped at 76 characters.
Note: The = at end of line is a "soft line break" —
it means the line continues on the next line.
The decoder removes these soft breaks when decoding.
Example 3: Equals Sign Encoding
Input text:
Price = $10.00
URL: https://example.com?a=1&b=2
Quoted-printable encoded:
Price =3D $10.00
URL: https://example.com?a=3D1&b=3D2
The = character must be encoded as =3D because
= is the escape character in quoted-printable.
Forgetting this is a common bug in custom implementations.