FormsPremium

Password Strength V2

A 4 px bar under the password field, and nothing else: a third in red, two thirds in orange, full in green. It rates the length and variety of characters, not real security.

JSAnimationPassword

Updated

This effect is part of Effect.Labs — 846 vanilla effects, some free, some premium. Forms has 21 effects, including 2 free. Explore the category →

3 usage examples

Password for the share link of a folder of scores — a choir's members' area — Password Strength V2 example 1

① Password for the share link of a folder of scores — a choir's members' area

WhenIn the small "Share this folder" panel, the choir director switches on "Ask for a password" and types it: the bar turns red, orange at the sixth character, green at the tenth.
WhyThe panel is 232 px wide and already holds a link, a switch and a button. One more verdict line would make it overflow; 12 px of bar is enough, and the sentence right below says what it measures.
SettingsLight theme: --pwsb-field:#fff, --pwsb-border:#d5ccbb, --pwsb-track:#e9e3d6, --pwsb-text:#231f1a, --pwsb-focus:#7c2d12, darkened level colours (#dc2626, #d97706, #059669), --pwsb-font-size:.85rem, --pwsb-width:100%. The visible note is linked to the field through aria-describedby. Typing played by the scene.
Activating an account on a phone — a neighbourhood community gardens app — Password Strength V2 example 2

② Activating an account on a phone — a neighbourhood community gardens app

WhenLast step of activation: the gardener picks a password. The "Activate my account" button stays grey; it turns dark green the moment the bar is full.
WhyOn a small screen the written rule already takes three lines: the bar is the short answer to that rule, with no repeated text. And the button has no calculation of its own, it reads the state the effect publishes.
Settings--pwsb-bar-height:6px, --pwsb-width:100%, --pwsb-focus:#3f6212, light theme. The scene watches data-strength on .pwsb-group and sets disabled on its button until the value is strong. The visible rule ("Full bar = at least 4 of these 5…") is linked through aria-describedby. In a real app the server runs the check again.
Keys of the three Wi-Fi networks of a shared woodworking shop — admin console — Password Strength V2 example 3

③ Keys of the three Wi-Fi networks of a shared woodworking shop — admin console

WhenThe page opens: three masked keys, three bars already drawn, green, orange, red. The manager retypes the guest network key; its bar climbs back and the "Too short" tag goes away.
WhyThree table rows, three instances of the effect: each rates its own value on load, with no typing. One look shows which key is the shortest, without displaying a single key in clear.
SettingsValues present in the value attribute: the effect rates them on start-up. --pwsb-font-size:.82rem, --pwsb-width:100%, default colours on a dark background, each field named by its hidden <label> ("Key for Varlope-Invites"). The "Too short" tag is scene code, wired to data-strength.

How it works

On every keystroke the script counts five points of shape: 6 characters or more, 10 or more, a capital from A to Z, a digit, a sign that is neither letter nor digit (an accented letter counts as a sign here). With 0 to 2 points the bar stops at 33% in red, with 3 points at 66% in orange, with 4 or 5 it is full and green. Empty field: empty bar.

The result lives in one attribute, data-strength on .pwsb-group (empty, weak, medium, strong). The CSS derives width and colour from it and the bar slides in 0.3 s; your code can read that same attribute to grey out a button, as in the phone example.

No word is displayed. Under the field the effect takes only 12 px (34 px for the version with text). The level in words still exists, in a region hidden on screen and read by screen readers; its three phrases are set in the hidden .pwsb-words block.

What the bar does not know: whether the password is on a list of stolen passwords, whether it follows a keyboard run, whether it is already used elsewhere. "Qwerty1!", eight characters, fills it green; a twenty-six-character sentence, all lowercase with spaces, stops at orange. It is a guide while typing. The real check happens on your server.

Accessibility

  • What is announced: the hidden .pwsb-status region is aria-live="polite" and is only rewritten when the level changes (3 announcements for 12 keystrokes, measured). Its texts say what is measured, "Length and variety: low", "medium", "good", not "strong password".
  • Field description: the script adds that region to aria-describedby without removing what you put there. A rule written under the field and linked by its id is therefore still read on focus.
  • Sighted users: they only get the bar. Its length changes with the colour (a third, two thirds, full), so colour is not the only carrier; but nothing says which criterion is missing. Keep a visible rule sentence next to it.
  • Label: "Password" sits in a <label> hidden on screen; the field's grey text is a hint and goes away on typing. autocomplete="new-password" lets password managers offer their own.
  • System-imposed colours: in high-contrast mode the bar gets an outline and a system colour.
  • Reduced motion: the bar changes length without sliding; only its colour fades in 0.2 s.

Browser compatibility

2.3 KB of dependency-free JavaScript. Floor set by NodeList.forEach: Chrome 51, Firefox 50, Safari 10 (@mdn/browser-compat-data). Checked on 04/12/2026 in Chromium 149, Firefox 151 and WebKit 26.5: two fields on the page, each with its own status region and id; typing in the second leaves the first untouched; value already present on load; form reset; an existing aria-describedby kept; 390 px touch screen; reduced motion; forced colours (Chromium and Firefox).

Chrome 51+✓ Full (measured in Chromium 149)
Firefox 50+✓ Full (measured in Firefox 151)
Safari 10+✓ Full (measured in WebKit 26.5)
Edge 79+✓ Full (Chromium engine)
iOS Safari 10+✓ Not checked on a real device
Android Chrome 51+✓ Full (Chromium engine)

With JavaScript off, the field takes input and submits normally; the bar stays empty and nothing is announced (measured).

The code

HTML structure to paste into your page (the CSS + JS come with your purchase):

index.html — structure
<div class="fx-0297-root">
  <div class="pwsb-group" data-strength="empty">
    <label class="pwsb-field">
      <span class="pwsb-sr">Password</span>
      <input class="pwsb-input" type="password" name="password" autocomplete="new-password" placeholder="Enter a password">
    </label>
    <div class="pwsb-meter" aria-hidden="true">
      <div class="pwsb-fill"></div>
    </div>
    <span class="pwsb-sr pwsb-status" aria-live="polite"></span>
    <span class="pwsb-words" hidden>
      <span data-level="weak">Length and variety: low</span>
      <span data-level="medium">Length and variety: medium</span>
      <span data-level="strong">Length and variety: good</span>
    </span>
  </div>
</div>

One-time payment, no subscription — the code is yours forever

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
Level colours (CSS — --pwsb-weak, --pwsb-medium, --pwsb-strong) #ef4444 · #f59e0b · #10b981 On a light background darken them (#dc2626, #d97706, #059669): the bar is thin, it needs contrast.
Bar (CSS — --pwsb-bar-height, --pwsb-track) 4px · white at 10% Thickness, and colour of the empty track. 6 px reads better on a phone.
Announced words (HTML — .pwsb-words) Length and variety: low · medium · good Read by the script at each change of level: translate them here. Avoid wording that promises security.
Field (CSS — --pwsb-field, --pwsb-border, --pwsb-focus, --pwsb-text) white at 5% · white at 10% · #6366f1 · #fff Fill, frame, frame on focus, text.
Sizes (CSS — --pwsb-width, --pwsb-font-size) 280px · 1rem The width is a ceiling; 100% fills the parent.
Demo backdrop (CSS — --pwsb-bg, --pwsb-min-height) #0a0a0f · 300px In a form: --pwsb-bg:transparent; --pwsb-min-height:0.
Scoring (JS — score() and the thresholds in update()) 5 points; red ≤ 2, orange = 3, green ≥ 4 To keep green for passwords of 10 characters, return 3 at most while pw.length < 10.

FAQ

The calculation is the same. Password Strength also writes a visible verdict under the bar, coloured like it. This V2 shows the bar only and keeps the words for screen readers: 12 px under the field instead of 34. Pick it when space is short or when the rule is already written next to the field; pick the other when the field stands alone and the word must be read.
No. It says the password is long enough and mixes several kinds of characters. It compares against no list of known passwords and spots neither "Qwerty1!" nor a date of birth. For a real estimate, plug a specialised library into score() and check on the server; the effect's display does not change.
No, it is appended. With aria-describedby="rule" in your HTML, the field carries aria-describedby="rule pwsb-status-1" after start-up: your rule is read first, the level next. The status region's id is created by the script, one per instance.