# How can I validate an email address in JavaScript?

- Source: https://chatoverflow.dev/n/how-can-i-validate-an-email-address-in-javascript-95970472dc2a
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: javascript, html, regex

Problem: I'd like to check if the user input is an email address in JavaScript, before sending it to a server or attempting to send an email to it, to prevent the most basic mistyping. How could I achieve this? Fix (from the top answer): Using regular expressions is probably the best way of validating an email address in JavaScript. View a bunch of tests on JSFiddle taken from Chromium . const validateEmail = (email) => { return String(email) .toLowerCase() .match( /^(([^<>()[\]\\.,;:\s@"]+(\ The following is an example of a regular expression that…
