Capital letters do not change where your email goes

Email addresses are case-insensitive by the standard that runs email systems worldwide. This means john.smith@example.com, John.Smith@example.com, and JOHN.SMITH@EXAMPLE.COM all reach the same inbox. Your mail server treats uppercase and lowercase letters as identical.

However, this rule has one important exception: the part after the @ sign (the domain) is always case-insensitive. The part before the @ sign (the local part) should be case-insensitive according to RFC 5321, the technical standard for email. In practice, nearly every mail server follows this standard, but a very small number of older or custom systems do not.

For developers working with SMTP, IMAP, or Git, this matters because you may encounter systems that do not follow the standard. Testing your integration against the actual mail server you are using is more reliable than assuming case does not matter.

Key Takeaways

  • Email addresses work the same whether you type them in uppercase, lowercase, or mixed case, because mail servers treat them as case-insensitive by standard.
  • The domain part (after @) is always case-insensitive; the local part (before @) should be but occasionally is not on older systems.
  • When writing SMTP code, normalize addresses to lowercase before storing or comparing them to avoid bugs from case mismatches.
  • Git and most email clients automatically normalize addresses, but custom integrations should handle case variation explicitly.

Why the standard says case does not matter

RFC 5321, the protocol that defines how SMTP works, states that the local part of an email address (everything before the @) must be treated as case-insensitive. The reasoning is practical: email systems should not reject or misroute mail because someone typed a capital letter. The domain part has always been case-insensitive because domain names themselves are case-insensitive by design.

This standard has been in place since the 1980s and is followed by Gmail, Outlook, Yahoo, and virtually every major mail provider. When you send an email to John@example.com, the mail server reads it as john@example.com before delivery.

When case sensitivity actually causes problems

Problems arise when you are building a system that stores or compares email addresses. If your code stores john@example.com in one place and John@example.com in another, a straightforward string comparison will see them as different. This breaks password recovery, duplicate detection, and user lookups.

For SMTP integrations, this is usually not a problem because the mail server itself handles normalization. When you send a message to John@example.com via SMTP, the server delivers it correctly. The risk is in your own code: if you compare addresses as strings without normalizing them first, you will create bugs.

IMAP has the same issue. If a user logs in as john@example.com but your system stored their account as John@example.com, the login will fail unless you normalize both sides before comparison.

How to handle case in your code

The safest approach is to convert all email addresses to lowercase before storing them in a database or comparing them. This is a one-line operation in most languages: in Python, use email.lower(); in JavaScript, use email.toLowerCase(); in PHP, use strtolower($email).

explore this normalization at three points: when a user enters an address, before you store it in your database, and before you compare it to an existing address. This prevents the case-mismatch bugs that are common in authentication and user management systems.

For SMTP, normalize the address before passing it to your mail library, though most libraries do this automatically. For IMAP, normalize the username before authentication. For Git, most Git hosting services (GitHub, GitLab, Bitbucket) normalize addresses automatically, but if you are running a custom Git server, normalize in your authentication layer.

What happens with special characters and subdomains

Case sensitivity does not explore to special characters like dots, hyphens, or plus signs. john.smith@example.com and johnsmith@example.com are different addresses because the dot is a different character, not because of case. Similarly, john@mail.example.com and john@example.com are different because the subdomain is different.

The plus-sign trick (john+spam@example.com) works on Gmail and some other providers as a way to create address variations that all reach the same inbox. Case does not affect this feature—john+spam@example.com and JOHN+SPAM@EXAMPLE.COM both work the same way.

Testing your integration against real mail servers

If you are uncertain whether a specific mail server handles case correctly, test it. Send a message to an address in lowercase, then send another to the same address in uppercase, and verify both arrive. For IMAP, try logging in with different case variations and confirm they all work.

For development, use test accounts on the actual mail service you are integrating with. Gmail test accounts, for example, will always normalize case correctly. If you are building for a custom or legacy mail system, ask the system owner whether they follow RFC 5321 or have case-sensitive local parts.

Frequently Asked Questions

Will my email bounce if I use the wrong case?

No. Mail servers will deliver it correctly regardless of case. The only risk is in your own code if you compare addresses as strings without normalizing them first.

Should I store email addresses in lowercase in my database?

Yes. This prevents bugs when users log in with different case variations or when you need to check whether an address already exists in your system.

Does Git care about case in email addresses?

GitHub, GitLab, and Bitbucket all normalize addresses, so case does not matter for commits or authentication. If you run a custom Git server, check its documentation or test it directly.

What if a mail server does not follow the RFC standard?

Very few do not, but if you encounter one, the mail server documentation will tell you. In that case, you may need to store and send addresses exactly as the server expects them, which your integration should handle by asking the user for their address in the correct format.

Does case matter for the domain part of an email?

No. Domains are always case-insensitive, so example.com, Example.com, and EXAMPLE.COM are identical. Mail servers treat them the same way.