1. Home
  2. Free tools
  3. Email list tools
  4. Email validation code generator

Email validation code generator for signup forms

Validate an email in layers. In the browser, use an email input and a loose pattern check with a typo hint. On the server, call a verification API to learn whether the mailbox exists. This generator gives copy-paste code for each layer in HTML, JavaScript, Node.js, Python, PHP and cURL, and lets you choose what to do with risky results.

When the verdict is risky (a mailbox that can't be confirmed)
export async function verifyEmail(email) {
  const res = await fetch(
    "https://simpleverifier.com/api/v1/verify?email=" + encodeURIComponent(email),
    { headers: { Authorization: `Bearer ${process.env.SIMPLEVERIFIER_KEY}` } }
  );
  if (!res.ok) return { action: "accept" }; // service problem: do not block signups
  const { status, reason } = await res.json();
  if (status === "valid") return { action: "accept" };
  if (status === "invalid") return { action: "reject", reason };
  return { action: "risky", reason }; // risky: ask the person to double-check the address
}

Calls the verification API from your backend. Keep the key in an environment variable.

Next step

Get an API key, or check your existing list first

The server snippets call the SimpleVerifier API, which needs a key from a plan that includes API access. Checking a list you already have needs no code.

  1. Drop your list as a CSV
  2. See its rows, duplicates and bad formats, free
  3. 100 free email checks when you sign in with Google, no card

Ready to verify now? See the API docs

By SimpleVerifier Team · Last updated · Runs in your browser; nothing you paste is sent to us

How do I validate an email address in a form?

  1. Pick the layer you need: the HTML input, the browser JavaScript, or a server snippet in Node.js, Python or PHP.
  2. For server code, choose what to do when the verdict is risky: accept it, ask the person to double-check, or ask for another address.
  3. Copy the code into your project.
  4. For server code, store your API key in an environment variable and never in the page.
  5. Test it on the form with a valid address, a typo and a made-up address.

What is the best way to validate an email address?

In layers, because each catches something different. A loose browser check catches slips such as a missing @ and offers a fix for gmial.com. A server check confirms the domain receives mail and, with a verification service, whether the mailbox exists. A confirmation email proves the person can read the inbox. A strict regex is not a good primary check: the real rules are wide (RFC 5322), and an over-strict pattern rejects real addresses. Our guide to the email validation regex shows how loose to go.

What should I do with a risky result?

Risky means the address may work but the server did not confirm the mailbox, as at an accept-all domain or a provider that never confirms mailboxes. Rejecting these loses real customers. A good default is to accept it, mark it unconfirmed and let a confirmation email decide, or to ask the person to double-check the spelling. Only block an invalid verdict, which will bounce. The snippets also let a service failure through, so an outage never blocks signups.

Why not call the verification API from the browser?

Anyone can read a key from your page and use your plan. Call the API from your backend and pass the verdict to the form. The framework walkthrough in verify email on signup in Next.js shows where it fits in a real route.

Who uses this tool, and for what?

Developers
Add a first-pass check and server verification to a signup route in a few minutes.
SaaS founders
Stop trial signups with typo and fake addresses from reaching the onboarding emails.
Agencies
Give a client's form a copy-paste validation layer in the language of their stack.

What can’t this tool tell you?

  • The browser snippets cannot tell whether a mailbox exists. Only the server-side check can.
  • Server snippets need an API key from a plan that includes API access.
  • The typo list in the browser snippet is a short sample; extend it for your audience.
  • A risky verdict is not a rejection. How you treat it is your call.

Common questions

How do I validate an email address in JavaScript?
Use an input with type=email, a loose check for text@text.tld, and a did-you-mean prompt for typo domains. Then verify on the server.
Is regex enough to validate an email?
Regex checks the shape only. It can't tell you the domain receives mail or the mailbox exists, and a strict one rejects real addresses.
Does the code work with any language?
Snippets are given for HTML, browser JavaScript, Node.js, Python, PHP and cURL. Any language that can make an HTTPS request can call the API.
Is an API key needed?
For the server snippets, yes. The HTML and browser JavaScript snippets work without one.
Does this tool store anything?
No. It generates text in your browser.

Sources

That was one address. Most people have a list.

The free checker does five addresses a minute, one at a time — fine for spot-checking, useless for a CSV of 40,000.

  • Upload a CSV up to 100,000 rows
  • Valid, risky and invalid exported as separate files
  • Repeat checks free for 14 days, no new connections

One plan, cancel anytime, no contract. Sign in with Google and your first 100 email checks are free, no card. The free tools stay free either way.

Clean your next list before it bounces

100 free email checks when you sign in with Google, no card. Then monthly plans from $9, or one flat price with fair use, never cut off.

100 free checks, no card Cancel anytime Secure payment by Stripe