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
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
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 like this
Build a Countdown Timer to Any Date With a Confetti Finish in One HTML File
Get a polished single-file countdown page with a custom event title, a large days-hours-minutes-seconds display and a confetti-and-chime celebration at zero.
Build a Keyboard-Friendly To-Do Checklist with Priorities and Filters in One HTML File
A ready-to-paste prompt that makes an AI build a single-file to-do checklist where you can add, reorder, prioritize, filter and export tasks as plain text, all with keyboard shortcuts.
Build a Random Team Picker That Splits Names Into Fair Groups in One HTML File
You get a single-file team picker: paste names, choose a team count or team size, watch an animated shuffle deal everyone into evenly sized teams, then reshuffle with one key.
Build a Restaurant Tip and Bill Splitter With Uneven Shares in One HTML File
A ready-to-paste prompt that builds a bill splitter where diners pay for what they ordered, tax and tip are shared fairly, totals round neatly, and every cent adds up.
Build an Instant Two-Way Unit Converter With Kitchen Measurements in HTML
A prompt that produces a single-file unit converter for length, weight, temperature, volume and cooking that updates both directions as you type, including cups-to-grams by ingredient.
Build a BMI and Daily Calorie Calculator with Metric and Imperial Units in HTML
A prompt that makes an AI build Steady Scale, a single-file BMI and calorie calculator using Mifflin-St Jeor, activity levels, unit switching and plain-language ranges.