Characters allowed in email addresses
Summary
Learn the correct email syntax rules, including character limits (local part ≤ 64, domain ≤ 255, total ≤ 254), allowed characters, special characters, and internationalized domains (IDNs). Understand RFC5321, RFC5322, and SMTP standards for valid email addresses.
Introduction #
If you have ever wondered why certain email addresses are considered invalid or why some special characters cannot be used, understanding the rules defined by internet standards is the key. Email address syntax is governed by technical documents known as Request for Comments (RFC), most notably RFC822, RFC5321, RFC5322, and RFC3490.
These documents specify the rules for both the local part (the portion before the @
symbol, the addressee) and the domain part (the portion after the @
). This article breaks down what characters you can use in an email address and explains how internationalized domain names are handled.
General syntax of an email address #
An email address consists of two parts: the local part and the domain part, separated by the at sign (@
). The general format is:
local-part@domain
RFC5322 defines the syntax in detail and allows complex structures using quoted strings and comments, but most modern applications follow a simplified interpretation based on RFC5321, which governs the Simple Mail Transfer Protocol (SMTP).
Email address character limits #
- Local-part — ≤ 64 chars
The local part must be less than or equal to 64 characters. - Domain part — ≤ 255 chars
The domain part must be less than or equal to 255 characters, when considered alone (e.g., in DNS). - Overall length — ≤ 245
The overall length must not exceed 254 characters.
RFC 5321 (SMTP protocol) states that an email address must not exceed 254 characters in total. This ensures compatibility with email systems and DNS restrictions.
Technically, the domain part can be up to 255 chars on its own, but when combined with the local part, the total number of characters per email address must be ≤ 254.
Local part #
The local part (addressee) is the section of the email address before the @
. According to RFC5321 and RFC5322.
Characters allowed #
The following characters (≤ 64 chars) are allowed in the local part:
- Uppercase and lowercase letters:
A-Z
,a-z
- Digits:
0-9
- Printable special characters (with some restrictions):
! # $ % & ' * + - / = ? ^ _ ` { | } ~
- Period (
.
), provided it is not the first or last character, and not used consecutively
Case sensitivity #
Case sensitivity matters: technically (RFC 5321),
User@domain.com
anduser@domain.com
can refer to different mailboxes, but in practice, most systems treat them as identical.
Quoted strings #
Additionally, the local part can be enclosed in double quotes ("
) to allow characters that are otherwise disallowed, such as:
- Space
- Backslash (
\
) - Comma (
,
)
For example:
"john.doe"@example.com
"john doe"@example.com
Quoted strings are uncommon and are often rejected by modern web forms despite being allowed by RFC standards.
Domain part #
The domain part is the section after the @
. It follows the rules defined in the Domain Name System (DNS) and is governed by RFC1035 and extended by RFC5321.
Characters allowed #
Allowed characters (≤ 255 chars) of the domain part include:
- Uppercase and lowercase letters:
A-Z
,a-z
- Digits:
0-9
- Hyphen (
-
), but not at the start or end of a label - Period (
.
) to separate domain labels - Cannot start or end with a hyphen (
-
) or dot (.
) - IP address enclosed in square brackets, e.g.
user@[192.168.2.1]
oruser@[IPv6:2001:db8::1]
(RFC5321, Section 4.1.3.)
For example:
example.com
mail.example-123.net
Case sensitivity #
The domain part is not case-sensitive.
Internationalized domain names #
Internationalized Domain Names (IDNs) allow domain names to include non-ASCII characters such as ü
, ñ
, or ç
. This is made possible through the use of Unicode characters, which are encoded into ASCII using a method called Punycode, as defined in RFC3490.
For example:
müller.de → xn--mller-kva.de
The email address may appear as user@müller.de
, but it is transmitted and resolved as user@xn--mller-kva.de
. This encoding ensures compatibility with legacy DNS systems that do not support non-ASCII characters.
Support for internationalized local parts also exists but is still limited and defined separately in RFC6531.
Examples #
The following is a list of valid but weird-looking email addresses that comply with RFC standards:
Special characters & symbols #
!def!xyz%abc@example.com
#$%&'*+-/=?^_`{}|~@domain.com
user.name+tag@example.org
(plus addressing)"very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@example.com
(quoted local part)
Quoted strings & spaces #
" "@example.org
(just a space inside quotes)"john..doe"@example.com
(dots inside quotes)"email"@domain.com
(local part in quotes)
Long & complex local parts #
user.name.with.many.dots@subdomain.example.co.uk
International & non-ASCII (IDN/Punycode) #
用户@例子.中国
(IDN →用户@xn--fsq092a.xn--fiqs8s
)üñîçøðé@müller.de
(Punycode:üñîçøðé@xn--mller-kva.de
)
Edge cases #
postmaster@[192.168.1.1]
(IP address as domain)admin@localhost
(non-public domain)"()<>[]:,;@\\\"!#$%&'-/=?^_`{}| ~.a"@example.org
(all RFC-allowed chars)
FAQ's #
Most common questions and brief, easy-to-understand answers on the topic:
What characters are allowed in the local part of an email address?
The local part of an email address can include letters, digits, and special characters such as ! # $ % & ' * + - / = ? ^ _ ` { | } ~
, and dots, under certain rules.
Can an email address include international (non-ASCII) characters?
Yes, international characters are allowed in the domain part through Internationalized Domain Names (IDNs), encoded using Punycode as per RFC3490.
Are spaces allowed in email addresses?
Spaces are only allowed in the local part if enclosed in quotation marks, and even then, support for such addresses is uncommon.
Is the domain part of an email case-sensitive?
No, the domain part of an email address is case-insensitive. For example, Example.com
and example.com
are treated the same.
What is Punycode and why is it used in email addresses?
Punycode is an encoding method defined in RFC3490 that converts Unicode characters into a limited character set for use in domain names.
Further readings #
Sources and recommended, further resources on the topic:
- RFC822 - Standard for ARPA Internet Text Messages
- RFC5321 - Simple Mail Transfer Protocol (SMTP)
- RFC5322 - Internet Message Format
- RFC3490 - Internationalizing Domain Names in Applications (IDNA)
License
Characters allowed in email addresses by Jonas Jared Jacek is licensed under CC BY-SA 4.0.
This license requires that reusers give credit to the creator. It allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, for noncommercial purposes only. To give credit, provide a link back to the original source, the author, and the license e.g. like this:
<p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://www.ditig.com/characters-allowed-in-email-addresses">Characters allowed in email addresses</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://www.j15k.com/">Jonas Jared Jacek</a> is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="license noopener noreferrer">CC BY-SA 4.0</a>.</p>
For more information see the Ditig legal page.