Password Validation

Learn password strength checking and password match validation with JavaScript interactive demos.

Password Strength Validation

These demos show how to measure password strength and confirm whether two passwords match. Strong passwords usually include a mix of uppercase letters, lowercase letters, numbers, and symbols.

Good password rules:
  • At least 8 characters long
  • Contains uppercase and lowercase letters
  • Contains a number
  • Contains a special symbol

Live Password Strength Demo

function getStrength(password) {
  let score = 0;
  if (password.length >= 8) score++;
  if (/[A-Z]/.test(password)) score++;
  if (/[a-z]/.test(password)) score++;
  if (/\d/.test(password)) score++;
  if (/[^A-Za-z0-9]/.test(password)) score++;
  return score;
}

Password Strength Live Demo

8+ characters Uppercase Lowercase Number Symbol

Confirm Password Demo

Password Match Checker