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@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    );
};

The following is an example of a regular expression that accepts unicode.

const re =
  /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;

Keep in mind that one should not rely on JavaScript validation alone, as JavaScript can be easily disabled by the client. Furthermore, it is important to validate on the server side.

The following snippet of code is an example of JavaScript validating an email address on the client side.

const validateEmail = (email) => {
  return email.match(
    /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
  );
};

const validate = () => {
  const $result = $('#result');
  const email = $('#email').val();
  $result.text('');

  if(validateEmail(email)){
    $result.text(email + ' is valid.');
    $result.css('color', 'green');
  } else{
    $result.text(email + ' is invalid.');
    $result.css('color', 'red');
  }
  return false;
}

$('#email').on('input', validate);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<label for="email">Enter email address</label>
<input id="email" type="email">

<p id="result"></p>

Top answer
1 of 16
6666

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@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    );
};

The following is an example of a regular expression that accepts unicode.

const re =
  /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;

Keep in mind that one should not rely on JavaScript validation alone, as JavaScript can be easily disabled by the client. Furthermore, it is important to validate on the server side.

The following snippet of code is an example of JavaScript validating an email address on the client side.

const validateEmail = (email) => {
  return email.match(
    /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
  );
};

const validate = () => {
  const $result = $('#result');
  const email = $('#email').val();
  $result.text('');

  if(validateEmail(email)){
    $result.text(email + ' is valid.');
    $result.css('color', 'green');
  } else{
    $result.text(email + ' is invalid.');
    $result.css('color', 'red');
  }
  return false;
}

$('#email').on('input', validate);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<label for="email">Enter email address</label>
<input id="email" type="email">

<p id="result"></p>

2 of 16
1384

I've slightly modified Jaymon's answer for people who want really simple validation in the form of:

[email protected]

The regular expression:

/^\S+@\S+\.\S+$/

To prevent matching multiple @ signs:

/^[^\s@]+@[^\s@]+\.[^\s@]+$/

The above regexes match the whole string, remove the leading and ^ and trailing $ if you want to match anywhere in the string. The example below matches anywhere in the string.

If you do want to match the whole sring, you may want to trim() the string first.

Example JavaScript function:

function validateEmail(email) {
  var re = /\S+@\S+\.\S+/;
  return re.test(email);
}
    
console.log(validateEmail('my email is [email protected]')); // true
    
console.log(validateEmail('my email is anystring@anystring .any')); // false

🌐
Medium
medium.com › @sketch.paintings › email-validation-with-javascript-regex-e1b40863ed23
Email validation with JavaScript Regex | by DreamDrafts | Medium
February 4, 2025 - In this article, we’ll explore a simple yet effective JavaScript regular expression (regex) for validating email addresses.
🌐
Mailtrap
mailtrap.io › blog › javascript-email-validation
JavaScript Email Validation: Tutorial with Code Snippets
June 18, 2025 - The validateEmail function takes an email address as input and returns true if the email matches the regex pattern, indicating a valid email format, or false otherwise. In our Mailtrap tutorial, we also cover how to use regex and Vue.js for ...
🌐
W3Resource
w3resource.com › javascript › form › email-validation.php
JavaScript : email validation - w3resource
Javascript function to validate an email. Also discussed an email structure, example of valid email and invalid email.
🌐
CyberPanel
cyberpanel.net › blog › how-to-do-email-validation-in-javascript
Email Validation in Javascript: Coding Samples & Tips 2024
June 15, 2025 - To do email validation in javascript using regex patterns and code examples, learn best practices, limitations and advice for exact javascript email validation.
🌐
MailerCheck
mailercheck.com › email list verification & deliverability testing tool › articles › how to validate email with javascript: tutorial and sample code
How to Validate Email with JavaScript: Tutorial and Sample Code - MailerCheck
June 17, 2024 - Learn how to validate emails with JavaScript using regex. This tutorial provides sample code and techniques for accurate email validation to ensure proper formatting and structure.
🌐
Fireship
fireship.dev › validate-email-address-javascript
How to validate an email address in JavaScript (2022)
In this post we'll talk about few common approaches for validating email addresses in JavaScript.
Find elsewhere
🌐
SiteLint
sitelint.com › home page › blog › programming › javascript › how to validate an email address in javascript
How to validate an email address in JavaScript – SiteLint
September 21, 2025 - The below code consists of two functions: isInputTypeSupported and isValidEmail. These functions are designed to validate input types and email addresses, leveraging the HTML5 form validation capabilities and custom logic for more comprehensive ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-program-to-validate-an-email-address
Validate Email in JavaScript - GeeksforGeeks
January 2, 2025 - The valid function checks whether a given email address matches the standard email format using a regular expression.
🌐
Simplilearn
simplilearn.com › home › resources › software development › javascript tutorial: learn javascript from scratch › how to do an email validation in javascript?
How to Do an Email Validation in JavaScript? [With Examples] | Simplilearn
August 31, 2025 - Email Validation in JavaScript is an important part of the user experience. Know what it is and how to do it. Read on to know more!
Address   5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › HTML › Reference › Elements › input › email
<input type="email"> - HTML - MDN Web Docs
1 month ago - Browsers automatically provide validation to ensure that only text that matches the standard format for Internet email addresses is entered into the input box. Browsers use an algorithm equivalent to the following regular expression: js ·
🌐
Reddit
reddit.com › r/javascript › how to validate an email address in javascript
r/javascript on Reddit: How to validate an email address in JavaScript
December 6, 2018 - You can check out this link to validate email address https://www.w3resource.com/javascript/form/email-validation.php · just finished a small book on how javascript works, would love your feedback ... Check if an email address exists without sending an email to that address. ... [AskJS] Does anyone know a web code editor for HTML/CSS/JS that also has a real time preview and allows multiple people to collaborate and edit?
🌐
CoreUI
coreui.io › blog › how-to-validate-an-email-address-in-javascript
How to validate an email address in JavaScript · CoreUI
September 20, 2024 - For more robust email validation, a regular expression (regex) is used to create a regex pattern that matches valid email formats. Regular expressions are patterns used for pattern matching within strings. In JavaScript, regex objects are used to define these patterns, and the test method is applied to check if the input string matches the pattern...
🌐
ZeroBounce
zerobounce.net › email-guides › email-validation-javascript
How to Do Email Validation in JavaScript
For any web or platform page you ... email verification. Even in its most basic form, the script will autodetect malformed entries and block out any data that are not appropriate for the field. Not only does this help you block invalid information, but it will provide a better user experience by giving immediate error feedback to the user. In most cases, visitors simply make mistakes during data entry and need to know what went wrong. When using a library like validator.js, you’ll ...
🌐
Jscrambler
jscrambler.com › blog › validating-email-pure-javascript
Email Validation: Validating your Email with Pure JavaScript
In this article, you learned how to validate an email using RegExp in pure JavaScript. This should get you started with email validation using Pure JavaScript. ... The leader in client-side Web security. With Jscrambler, JavaScript applications become self-defensive and capable of detecting and blocking client-side attacks like Magecart.
🌐
SitePoint
sitepoint.com › javascript
Validate email using jQuery - JavaScript
I have a problem verifying email address with script below, its not working even if i enter correct email format, it doesn’t move to next hidden div first i want to do empty-check and then validate if entered email is in good format $('#fobtn').click(function(){ var email = $('#email').val(); var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if( !$(this).val() ) { $("#error").html("email needed cant leave this bl...
Published   March 17, 2025
🌐
Formspree
formspree.io › blog › email-validation-in-javascript
Mastering Email Validation in JavaScript: Techniques and Best Practices | Formspree
October 9, 2024 - Validator.js is a lightweight, dependency-free library that simplifies the process of validating various types of input, including email addresses on both server and browser environments.
🌐
Scaler
scaler.com › topics › email-validation-in-javascript
How to Do an Email Validation in JavaScript? - Scaler Topics
July 27, 2022 - Scaler Topics certification course provides the training and recognition you need to succeed. ... A: Form validation in JavaScript means applying some checks to the form data at the time of entering data so that the wrong type of data is not sent to the server and errors occur.
🌐
Medium
medium.com › @python-javascript-php-html-css › how-to-use-javascript-to-verify-an-email-address-464493b60839
How to Use JavaScript to Verify an Email Address
September 17, 2024 - This approach is useful for providing ... The server-side script, implemented with Node.js and Express, listens for POST requests on the endpoint /validate-email....
🌐
Clearout
clearout.io › clearout: bulk email validation & email verification service | email verifier, email finder and email tester › integrations › real time javascript email validation
Javascript Email Validation Widget | Clearout
September 9, 2025 - Clearout's email validation JS widget 2.0 instantly verifies emails in real-time as they're entered into your forms, accepting only valid email addresses and keeping your email list clean.