webdevpuneet.com

Bootstrap Signup Form with Password Strength Meter — Free Snippet

Bootstrap Signup Form with Password Strength Meter · Forms · Plain HTML, CSS & JS · Live preview

CategoryForms

Copy & paste

Source Code

<div class="container py-5 d-flex justify-content-center">
  <div class="card bspw-card">
    <div class="card-body p-4">
      <h5 class="fw-bold mb-3">Create your password</h5>
      <label class="form-label small fw-semibold">Password</label>
      <input type="password" class="form-control mb-2" id="bspwInput" placeholder="At least 8 characters">

      <div class="bspw-meter mb-2"><div class="bspw-meter-bar" id="bspwBar"></div></div>
      <p class="small fw-semibold mb-3" id="bspwLabel">Enter a password</p>

      <ul class="list-unstyled bspw-rules small">
        <li id="bspwRuleLen">○ At least 8 characters</li>
        <li id="bspwRuleUpper">○ One uppercase letter</li>
        <li id="bspwRuleNum">○ One number</li>
        <li id="bspwRuleSpecial">○ One special character</li>
      </ul>
      <button class="btn btn-dark w-100 fw-bold mt-2" id="bspwSubmit" disabled>Create account</button>
    </div>
  </div>
</div>

Extend with AI

Take This Snippet Further With AI

The AI prompt for this one is for Patreon supporters ($3 a month), along with a site with no ads. Supporters enter the passcode once and it is remembered in this browser.

· Become a supporter

What's included

Features

Real Bootstrap 5.3 form-control password field, loaded from the actual CDN
Four independently checked rules — length, uppercase, number, special character
Live strength meter and label, both recalculated on every keystroke
Submit button is genuinely disabled, not just visually discouraged, until every rule passes
Each rule is a small, independently testable {test, el} object — easy to add a fifth rule
No password-strength library — all four checks are plain regular expressions

About this UI Snippet

Bootstrap Signup Form with Password Strength Meter — HTML, CSS & JavaScript

Screenshot of the Bootstrap Signup Form with Password Strength Meter snippet rendered live

Rather than a vague "your password is weak" message after submission, this snippet checks four password rules — length, an uppercase letter, a number, a special character — live, on every keystroke, against a real Bootstrap form-control password field. Each rule is a small { test, el } object; a shared input listener runs every test against the current value, toggles a ✓/○ marker and a green "met" color per rule, and derives an overall strength percentage from how many of the four currently pass.

The submit button stays genuinely disabled until all four rules pass — not just visually discouraged, but functionally unclickable — which is the detail that actually prevents a weak password from being submitted, rather than merely suggesting a stronger one.

Step by step

How to Use

  1. 1
    Load the snippetClick the snippet in the sidebar Library tab. The preview loads an empty password field and a disabled submit button.
  2. 2
    Type a short passwordThe meter fills partially, the label reads "Weak" or "Fair", and only some rules show a green checkmark.
  3. 3
    Type a password meeting all four rulesE.g. "Secure#2026" — the meter fills to 100% green, the label reads "Strong", and the submit button becomes enabled.
  4. 4
    Delete a characterRemove the special character — that rule reverts to unmet and the submit button disables again immediately.

Real-world uses

Common Use Cases

Signup and account-creation forms
Real-time password feedback catches weak passwords before submission instead of after a failed server-side check.
Learning live multi-rule form validation
A clear pattern for checking several independent conditions against one input and deriving both per-rule and overall feedback.
Reducing support load from confusing password errors
Showing exactly which rule is unmet, live, is more helpful than a generic "password too weak" error after the fact.
Password reset and change-password flows
Reuse the same meter and rule-checking pattern anywhere a new password is being set, not just at signup.

Got questions?

Frequently Asked Questions

Genuinely disabled — its disabled property is set to true/false based on whether all four rules pass, so it's functionally unclickable (and correctly skipped in tab order) until the password meets every requirement.

At least 8 characters, one uppercase letter, one number, and one special (non-alphanumeric) character — each checked with its own regular expression against the current input value.

It's simply how many of the four rules currently pass, divided by four — 1 of 4 rules met fills the meter to 25%, 4 of 4 fills it to 100% and turns it green.

Yes — add a new entry to the rules object with its own test function and a matching <li> element in the HTML, and update the LEVELS array and the met < 4 check to account for five total rules.

No — this is a front-end demo. Wire the submit button's click handler to a real signup API call once the password (and any other required fields) pass validation.