Free developer tool

Email regex tester

Test email addresses against four proven validation patterns — the practical one most apps should use, the exact HTML5 spec regex, a loose sanity check, and a strict RFC-style rule. Copy the regex or working code for JavaScript, Python and HTML.

100% private. Everything runs in your browser — your text is never uploaded to a server or logged. Saved lists stay on your device.
Pattern

Results0 match0 fail
Each line is tested against the selected pattern — matches and failures show up here.
Saved listsStored only on this device — never uploaded. Clear anytime.
No saved lists yet. Paste a list into the tool above, then clickSave current list to keep it on this device.

The practical email regex, explained

/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/
  • ^[A-Za-z0-9._%+-]+ — the name before the @: letters, digits, dots, underscores, percent, plus (for tags like name+news@) and hyphens.
  • @ — exactly one at-sign.
  • [A-Za-z0-9.-]+ — the domain, including subdomains (mail.co.jp).
  • \.[A-Za-z]{2,}$ — a final dot followed by a TLD of two or more letters, so name@server and name@site.c fail.

It isn't a full RFC 5322 parser on purpose. It accepts every address a real person will type and rejects the typos that actually show up in sign-up forms — which is the job.

Email regex in JavaScript

const EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/;

EMAIL_RE.test("name@example.com");   // true
EMAIL_RE.test("not-an-email");       // false

// To find every email inside a longer string,
// drop the ^ $ anchors and add the g flag:
const FIND_RE = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g;
text.match(FIND_RE);                 // ['a@x.com', 'b@y.io', …]

Email regex in Python

import re

EMAIL_RE = re.compile(r"^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$")

bool(EMAIL_RE.match("name@example.com"))   # True
bool(EMAIL_RE.match("not-an-email"))       # False

# Find every email inside a longer string:
re.findall(r"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}", text)

Email validation in HTML — no regex needed

<input type="email" name="email" required>

<!-- The browser validates using the WHATWG email regex
     automatically — no JavaScript needed. Add multiple
     to accept a comma-separated list of addresses. -->

For plain form validation, let the browser do it. Reach for your own regex when you need to validate server-side, clean bulk lists, or apply stricter rules than the spec (like requiring a dot in the domain).

Validate less, verify more

A regex checks shape, not existencename@gmial.com passes every pattern on this page and still bounces. Treat format checks as the first filter: validate the shape, then confirm with a real email. To check a whole list at once, use theemail validator; to pull addresses out of raw text, the email extractor uses the unanchored version of the practical pattern above. There's also aplain-English guide to what makes an address valid.

Frequently asked questions

What is the best regex for email validation?

For almost every app: ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$ — it accepts every address a real person will type (dots, plus-tags, subdomains, country TLDs) while rejecting obvious garbage like missing @ or no TLD. Stricter patterns reject real addresses; looser ones let typos through.

What regex does HTML5 use for input type=email?

Browsers implement the WHATWG-specified pattern, which allows the full set of special characters RFC 5322 permits in the local part and validates each domain label's length. One quirk: it accepts a domain without a dot (like name@localhost), so many sites still add their own check for a TLD.

Why not use the full RFC 5322 regex?

The fully RFC-compliant regex is thousands of characters long, allows things no mail provider actually accepts (quoted strings, comments, IP-literal domains), and still can't tell you whether the mailbox exists. Validating format with a practical pattern and confirming with a real email is what production systems do.

How do I match emails in a block of text instead of validating one?

Remove the ^ and $ anchors and add the global flag: /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g. Anchored patterns test whether an entire string is an email; unanchored ones find every email inside a string. Our email extractor uses exactly this pattern.

Can a regex tell me if an email address actually exists?

No. Regex only checks the format. name@gmial.com is perfectly formatted but undeliverable. To verify a mailbox exists you need an SMTP-level check or a confirmation email — format validation is the first filter, not the last.

More free email tools