Definition
Email encoding refers to the methods used to represent characters and binary data in email messages so that they can be transmitted correctly over SMTP, which historically supported only 7-bit ASCII. Modern email uses UTF-8 as the standard character encoding for message content, supporting the full range of international characters, emojis, and special symbols. Quoted-printable encoding is used for text content that is primarily US-ASCII with occasional non-ASCII characters, while Base64 encoding is used for binary content such as image attachments and non-text MIME parts.
Quoted-printable encoding works by converting non-ASCII characters into an equals sign followed by two hexadecimal digits, such as =E2=9C=93 representing a check mark. This encoding is efficient for mostly-ASCII content because the overhead is limited to only the non-ASCII characters. Base64 encoding converts binary data into a 64-character ASCII representation, adding approximately 33% overhead to the original data size. Email content is typically encoded as quoted-printable for readability and debugging, while attachments use Base64.
Header encoding, also known as MIME encoded words, is used for subject lines and other header fields that contain non-ASCII characters. The format is =?charset?encoding?encoded-text?=, for example =?UTF-8?B?SSBvdmUgRW1haWw=?= for Base64 or =?UTF-8?Q?I_love_=E2=9C=93?= for quoted-printable headers. Character encoding errors, such as mismatched charset declarations or incorrectly encoded special characters, can cause rendering issues in email clients, particularly for internationalised subject lines and emojis used in display names.
Best Practices
Set the Content-Type charset to UTF-8 for all email content. UTF-8 is universally supported by modern email clients and provides the broadest character coverage with reasonable overhead.
Use quoted-printable encoding for HTML and plain text message bodies. Quoted-printable produces smaller message sizes than Base64 for text content and is human-readable in raw message inspection.
Use Base64 encoding only for attachments and embedded images. Applying Base64 to entire message content unnecessarily increases total email size and can push emails closer to clipping or size limits.
Encode non-ASCII characters in subject lines using MIME encoded words with UTF-8 charset. Embedding raw UTF-8 bytes in subject headers can cause corruption in older email clients and MTAs.
Avoid mixing character encodings within a single message. Declare UTF-8 at the MIME part level and ensure that all content in that part is actually UTF-8 encoded.
Test email rendering with international characters and emojis across your target email clients. Some older Outlook versions on Windows have limited Unicode support and may show placeholder characters or question marks.
Frequently Asked Questions
Traditional SMTP is a 7-bit protocol per RFC 5321, meaning it can only transmit ASCII characters directly. MIME encoding (quoted-printable or Base64) is used to encode non-ASCII content into 7-bit-safe form. ESMTP with the 8BITMIME extension allows 8-bit content but quoted-printable remains the standard for broad compatibility.
Quoted-printable adds approximately 0–50% overhead depending on how many non-ASCII characters are present. Base64 adds exactly 33% overhead to any data it encodes. Choosing quoted-printable for text content and Base64 only for attachments minimises total email size.
Email clients may display garbled text, substitution characters, or question marks when the declared charset does not match the actual encoding. For example, declaring ISO-8859-1 (Latin-1) when the content is UTF-8 will cause extended characters and emojis to appear incorrectly.
Emojis are Unicode characters in the Supplementary Multilingual Plane (code points U+1F300 to U+1F9FF). In UTF-8, they are represented as 4-byte sequences. In quoted-printable, each emoji becomes a sequence of equals-sign hex pairs (e.g., =F0=9F=99=82 for a peace sign emoji). Subject lines require MIME encoded word syntax.
Yes, Base64 is the standard encoding for binary attachments transmitted via SMTP. The attachment is Base64-encoded within its MIME part, and the Content-Transfer-Encoding header is set to "base64". Without Base64 encoding, binary attachment data would corrupt during SMTP transmission.