Build a Strong Password Generator with Strength Meter in One HTML File

You get a single HTML file that makes cryptographically random passwords, with toggles for character sets, an entropy-based strength meter and one-click copy.

The prompt

Prompt
Act as a senior front-end developer who builds small, polished, privacy-first browser tools.

Build Keysmith, a strong password generator that runs entirely in the browser. It creates passwords with crypto.getRandomValues, using rejection sampling so there is no modulo bias, and never sends or stores anything.

Rules:
1. Controls: a length slider from 8 to 64 (default 20) with the live number beside it, and checkboxes for lowercase, uppercase, digits, symbols and "avoid ambiguous characters" (I, l, 1, O, 0, o, |). Every change regenerates the password at once. If every set is unchecked, turn lowercase back on and explain why in a status line.
2. Each enabled set contributes at least one character. Then shuffle with a crypto-based Fisher-Yates shuffle.
3. Show the password in a large monospace box, with digits and symbols tinted in different colors. Add a strength meter bar, a label (Weak, Fair, Strong, Very strong), entropy in bits (length times log2 of pool size), and an estimated offline guess time at 10 billion guesses per second.
4. Copy button: use the Clipboard API. If that fails, fall back to execCommand. If both fail, select the text and tell the user to press Ctrl+C. Confirm in an aria-live status line.
5. Keyboard shortcuts: G for a new password, C to copy. Show visible focus rings and keep text readable.
6. Use a warm light background, a white card, one deep-green accent, and a layout that fits 360 to 1280px. Disable the meter animation under prefers-reduced-motion. Use no forms, no storage and no external resources.

Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.

Example output

One HTML file. Save it and open it in any browser.Open full screen

Example: Keysmith, a private, offline password generator with a live strength meter.

A fresh 20-character password appears on load, with digits shown in blue and symbols in orange.

  • Adjust: drag the length slider or flip the character toggles, and the password, entropy, strength label and guess-time estimate all update instantly.
  • Copy: click Copy or press C.
  • New password: press G or use the button.
  • Try it: uncheck every set and watch lowercase switch itself back on.
Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Requiring crypto.getRandomValues with rejection sampling rules out Math.random and modulo bias, so the passwords are truly uniform.
  • A three-step copy fallback (Clipboard API, then execCommand, then select text) keeps copying usable inside sandboxed previews.
  • Defining entropy as length × log2(pool) gives the meter a clear formula the model implements the same way every time.

Paste the prompt into ChatGPT, Claude or Gemini. Save the returned code as keysmith.html and open it in any browser, or run it in the chat's preview or canvas. Copy may need a click inside the page first.

Common edits

  • Change the default length, the slider range or the symbol set to match a site's password rules.
  • Add a passphrase mode that joins random words from a small built-in word list, using the same crypto picker.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Mini Apps & Tools