DocsGuidesPassword strength

A lock that closes as a password gets stronger

The lock closes as the phrase gets stronger. The words under it carry the meaning.

1 min readUpdated November 2026Fidgicons 1.0

function score(p) {
  let s = Math.min(p.length / 16, 1) * 0.6;
  if (/[a-z]/.test(p) && /[A-Z]/.test(p)) s += 0.15;
  if (/\d/.test(p)) s += 0.1;
  if (/[^\w\s]/.test(p)) s += 0.15;
  return Math.min(s, 1);
}

input.addEventListener('input', () => {
  const s = score(input.value);
  lock.style.setProperty('--v', s);
  label.textContent = s < 0.4 ? 'Weak' : s < 0.75 ? 'Getting there' : 'Strong';
});
Something missing or unclear?Write to usRequest an icon