Blog
Signup form validation best practices: fewer fields, better errors, checks that run on the server
How to validate a signup form without losing real users: when to check, how to word errors, accessible markup, server-side checks and proportionate friction.
Updated 2026-11-24
A signup form should make the right answer easy and the wrong answer visible. Ask for as little as you need, check each field when the person leaves it, explain errors next to the field in words they can act on, and run the checks that matter on your server, where they cannot be skipped. Every other rule here follows from keeping real people moving while your data stays clean.
Ask for less
Each field is a place to lose someone. Before you add one, ask what you would lose without it.
- Email and password are usually enough. Ask for a name, a company or a phone number only when the product needs it at signup. Ask later, in context, when the reason is obvious.
- One field per fact. One name field, not first, middle and last, unless something downstream needs the parts. One phone field with a country selector, not three boxes.
- Do not ask twice. A "confirm your email" field mostly teaches people to paste. A typo suggestion and a confirmation email do the job better.
- Say what each field is for when it is not obvious, especially a phone number. People give a number to a form that says why.
A shorter form also collects less personal data, which helps under the GDPR principle of data minimisation. See GDPR and contact data validation.
When to validate
| Moment | What to do | Why |
|---|---|---|
| While typing | Light hints only: format as you go, show a character counter | A half-typed value is not an error |
| On blur | Check the field and show a specific error if it fails | The person has finished with the field |
| On submit | Check every field, focus the first error | Catches what blur missed, and values filled by a browser |
| On the server | Repeat every rule, then add the data checks | The only check an attacker cannot skip |
Clear an error as soon as the value becomes valid, not on the next submit. Never disable the submit button as the only signal of a problem: a greyed-out button with no explanation is the worst error message.
const field = document.querySelector('#email')
const message = document.querySelector('#email-error')
field.addEventListener('blur', () => {
const value = field.value.trim()
const ok = value.includes('@') && !/\s/.test(value)
field.setAttribute('aria-invalid', String(!ok))
message.textContent = ok ? '' : 'Enter your email as name@example.com.'
})
field.addEventListener('input', () => {
if (field.getAttribute('aria-invalid') === 'true' && field.value.includes('@')) {
field.setAttribute('aria-invalid', 'false')
message.textContent = ''
}
})
The client check is deliberately loose. A strict pattern in the browser rejects real addresses, and email validation regex shows how little a pattern can know.
Write errors people can act on
An error message has three jobs: say which field, say what is wrong and say how to fix it.
| Instead of | Write |
|---|---|
| Invalid input | Enter your email as name@example.com |
| Invalid phone | This number looks too short for France. Check the digits. |
| Error | This address cannot receive email. Did you mean jane@gmail.com? |
| Password rejected | Use at least 12 characters. This one appears in a list of leaked passwords. |
Rules to keep:
- Show the error next to the field, in text, in addition to color. Color alone fails people who cannot see it.
- Keep what the person typed. Never clear a field because it failed.
- Do not blame. Say what to do, not what they did.
- Show an example for the selected country when a phone number fails.
- Suggest a fix when you can. The email API returns
did_you_meanwhen a domain looks like a typo of a common one, such asgmial.com.
Accessible markup
Forms are where accessibility failures cost the most. The WCAG success criteria that apply most directly:
| Criterion | What it asks for | In practice |
|---|---|---|
| 3.3.2 Labels or Instructions | Labels or instructions are provided when content needs user input | A visible <label> for each field, not a placeholder |
| 3.3.1 Error Identification | An error is identified and described in text | aria-invalid and a message linked with aria-describedby |
| 3.3.3 Error Suggestion | A suggestion is offered when one is known | The did_you_mean text, or the expected format |
| 1.3.5 Identify Input Purpose | Fields about the user carry their purpose in code | Correct autocomplete values |
Useful attributes: type="email" with autocomplete="email", type="tel" with autocomplete="tel" and inputmode="tel" for a phone number, and autocomplete="new-password" on a password. Do not use type="number" for a phone number, because it drops the + and leading zeros. Move focus to the first invalid field after a failed submit, and announce the error to screen readers.
Passwords
If you ask for a password, follow current guidance instead of folklore. NIST Special Publication 800-63B recommends allowing long passwords, checking a chosen password against lists of commonly used or compromised passwords, and not imposing composition rules or periodic changes without evidence of compromise. In a form, that means a length minimum, a clear message when a password is on a blocklist, a show-password toggle and support for password managers, and no rules like one capital, one symbol.
Validate on the server
Everything above is for the person. The server is for the truth. It repeats every rule and adds the checks a browser cannot make.
| Field | What the server can add | Endpoint |
|---|---|---|
| Typo suggestion, domain with mail servers, disposable and role addresses, mailbox check | ||
| Phone | Validity in the numbering plan, E.164 form, line type | phone |
| IP address | Country, network type, Tor, VPN, proxy and data center flags, risk level | ip |
A batch call runs all three in one request:
export async function checkSignup({ email, phone, country, ip }) {
const items = [{ type: 'email', email, mode: 'fast' }]
if (phone) items.push(country ? { type: 'phone', phone, country } : { type: 'phone', phone })
if (ip) items.push({ type: 'ip', ip })
let data
try {
const response = await fetch('https://api.qelka.com/v1/batch', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ items }),
signal: AbortSignal.timeout(8000),
})
if (!response.ok) return { checked: false }
data = (await response.json()).data
} catch {
return { checked: false }
}
const [emailResult, ...rest] = data
const phoneResult = phone ? rest[0] : null
return { checked: true, emailResult, phoneResult }
}
Run the check once, on submit, on the server. The function above returns checked: false when anything goes wrong, so the caller can let the signup through. The full version, with the three outcomes, is in validate signup forms, and the batch endpoint is described in the batch reference.
Fail open, except where a failure costs money
If the API is slow or unreachable, let the signup go through and check the address later. A validation service should never be the reason nobody can register. The exception is a paid action. Do not send an SMS code when the number could not be checked, because each message costs money and SMS pumping fraud preys on forms that send first and think later.
Decide what each result does
| Result | Outcome |
|---|---|
Email deliverable |
Accept |
Email undeliverable |
Ask for a correction, with did_you_mean if present |
Email risky, disposable |
Your policy: refuse with a clear message, or accept and flag |
Email risky, catch_all, or unknown |
Accept, and let the confirmation email settle it |
Phone valid |
Accept, store e164 |
Phone invalid |
Ask for a correction |
Phone unknown |
Ask for the country |
IP risk.level high |
Add a step: confirm email or phone before activating the account |
Never block on unknown: it means the check could not reach a conclusion. Never block on an IP level alone, since VPNs and corporate networks are everyday tools. Prevent fake signups combines the signals, and VPN, proxy and Tor detection explains the flags.
Confirm, do not just validate
Validation says an address can receive mail. It does not say the person controls it. Send a confirmation email and activate the account when the link is used, or let people use the product with limits until then. For a phone number, a one-time code proves possession. Validate before you send either, so you do not pay for impossible destinations. Phone number validation covers the difference between validating and verifying.
Add friction in proportion
Real people are the majority. Friction should rise with the evidence, and with what is at stake.
- Nothing for clean signups. Most traffic should not notice your defences.
- A confirmation for weak signals. A
mediumIP level, a catch-all domain or a mismatched country earns an email confirmation before trial credits. - An extra step for strong signals. A Tor exit with a disposable address earns phone verification or review.
- Limits behind the form. Rate limit signups per IP, per network and per device, so scripts cannot try thousands of variations.
- Hold what attackers want. Delay rewards and credits until the account has some history.
A blocklist with no appeal turns a defence into a support burden. Offer a way out: a message that says what to do next, and a contact address.
Measure the form
You can only improve what you watch. Track these from your own data:
- Completion rate from first field touched to account created.
- Error rate per field, to see which message confuses people.
- Bounce rate of the confirmation email, which falls when typo suggestions work.
- Share of signups that confirm.
- Abuse that got through, such as accounts later banned, split by the signals they showed at signup.
Do not copy another site's thresholds. Run any new rule in shadow mode first: log what it would have done for two weeks and read the cases.
Test it
A test key, sk_test_, returns sample data and spends no credits, so you can build the whole flow before launch. See test mode. Try the checks by hand with the free email verifier, phone validator and IP lookup, and see validate phone numbers in a signup form and block disposable emails at signup for the practical steps.
Where to go next
- Signup fraud prevention for how teams use the checks together.
- Stop fake signups without a CAPTCHA for the lighter alternative.
- Pricing for credits and plans.
Frequently asked questions
When should a signup form validate its fields?
Is client-side validation enough?
How should I word form error messages?
Should I ask for a phone number at signup?
Should a signup form block disposable email addresses?
status: "risky" with reason disposable so you can pick either. Whatever you choose, tell the person why, and offer to continue with another address.What should happen when the validation service is down?
Put this check in your product
Get an API key in under a minute. 100 free credits every month, no card required.
- 100 free credits a month
- No card
- Test keys spend nothing
- Cancel any time