Neon Password Strength
A password strength meter made of neon. It lights the whole card in its color, and a weak password makes the tube spark and die.
- Sign in & forms
- Free
- neon
- Added Sep 16, 2026
<style>
/* --glow is set by the script to the current neon color, everything lit by the tube reads it */
.neon-form { --glow: 255, 77, 94; --light: 0;
position: relative; box-sizing: border-box; width: min(380px, 92vw); padding: 26px 24px 24px; border-radius: 26px; color: #F3F5F8;
background:
radial-gradient(120% 70% at 50% 62%, rgba(var(--glow), calc(var(--light) * .22)), transparent 60%),
linear-gradient(#12161D, #0C0F14);
border: 1px solid rgba(var(--glow), calc(.08 + var(--light) * .35));
transition: border-color .25s ease; }
/* the outer glow lives on its own layer so only its opacity animates, not a repainted box-shadow */
.neon-form::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
box-shadow: 0 0 70px rgba(var(--glow), .35); opacity: var(--light); transition: opacity .25s cubic-bezier(.23, 1, .32, 1); }
.neon-form h2 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.neon-form .rules { margin: 4px 0 18px; font-size: 13px; color: #7A8290; }
.neon-field { position: relative; }
.neon-field input { width: 100%; box-sizing: border-box; height: 48px; padding: 0 44px 0 16px; border-radius: 12px; outline: none;
background: #080A0E; color: #F3F5F8; font: 500 17px Menlo, monospace;
border: 1px solid rgba(var(--glow), calc(.18 + var(--light) * .45)); }
.neon-field button { position: absolute; right: 8px; top: 8px; width: 32px; height: 32px; border: 0; background: none; color: #7A8290; cursor: pointer; }
.neon-form.shake .neon-field { animation: shake .45s cubic-bezier(.23, 1, .32, 1); }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
/* the tube: four glass segments, the lit ones glow in the current color */
.tube { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 6px 8px; }
.tube i { height: 9px; border-radius: 9px; background: #10141A; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); transition: background .08s, box-shadow .08s; }
.tube i.on { background: rgb(var(--glow));
box-shadow: 0 0 5px rgba(var(--glow), .9), 0 0 16px rgba(var(--glow), .5), 0 0 38px rgba(var(--glow), .35), inset 0 2px 0 rgba(255,255,255,.5); }
.tube i.ignite { animation: ignite .22s steps(1); }
@keyframes ignite { 0%, 40%, 80% { opacity: .15; } 20%, 60%, 100% { opacity: 1; } }
.tube.sputter i.on { animation: sputter .5s steps(1) forwards; }
@keyframes sputter { 0%, 30%, 55% { opacity: 1; filter: brightness(1.3); } 15%, 45%, 70% { opacity: .05; } 100% { opacity: 0; } }
.spark { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #FFE3C4; box-shadow: 0 0 8px #FF6A4D; pointer-events: none; }
.neon-label { min-height: 18px; margin: 0 6px 14px; font-size: 13px; font-weight: 600; color: rgb(var(--glow)); }
.neon-form .go { width: 100%; height: 44px; border: 0; border-radius: 12px; font: 650 15px system-ui, sans-serif; cursor: pointer;
background: #1A1F27; color: #8A93A1; transition: background .2s ease, color .2s ease, transform .16s cubic-bezier(.23, 1, .32, 1); }
.neon-form .go:active { transform: scale(.97); }
.neon-form.strong .go { background: rgb(108, 235, 217); color: #03201C; box-shadow: 0 0 26px rgba(108, 235, 217, .5); }
@media (prefers-reduced-motion: reduce) { .tube i.ignite, .tube.sputter i.on, .neon-form.shake .neon-field { animation: none; } }
</style>
<form class="neon-form" novalidate>
<h2>Create a password</h2>
<p class="rules">10+ characters, a capital, a digit, a symbol</p>
<div class="neon-field">
<input id="pw" type="password" autocomplete="new-password" aria-describedby="neon-label" placeholder="Type a password">
<button type="button" class="reveal" aria-label="Show password">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12Z"/><circle cx="12" cy="12" r="3"/></svg>
</button>
</div>
<div class="tube" aria-hidden="true"><i></i><i></i><i></i><i></i></div>
<div class="neon-label" id="neon-label" aria-live="polite"></div>
<button class="go" type="submit">Continue</button>
</form>
<script>
// the rules that make a password strong, and the neon color for 1, 2, 3 and 4 of them
const RULES = [/.{10,}/, /[A-Z]/, /\d/, /\W/];
const HUE = ['#FF4D5E', '#FF9F43', '#FFD166', '#6CEBD9'];
const LABELS = ['', 'Weak', 'Getting there', 'Almost', 'Strong password'];
const score = pw => RULES.filter(r => r.test(pw)).length;
const form = document.querySelector('.neon-form');
const input = form.querySelector('#pw');
const label = form.querySelector('.neon-label');
const segs = [...form.querySelectorAll('.tube i')];
const hex = h => [1, 3, 5].map(i => parseInt(h.slice(i, i + 2), 16)).join(', ');
const tube = {
lit: 0,
light(n, hue) {
form.style.setProperty('--glow', hex(hue[Math.max(0, n - 1)]));
form.style.setProperty('--light', n / 4);
segs.forEach((s, i) => {
const on = i < n;
if (on && i >= this.lit) { s.classList.remove('ignite'); void s.offsetWidth; s.classList.add('ignite'); }
s.classList.toggle('on', on);
});
this.lit = n;
form.classList.toggle('strong', n === 4);
label.textContent = LABELS[n];
},
sputter() {
const box = form.querySelector('.tube');
box.classList.add('sputter'); form.classList.add('shake');
label.textContent = 'Too easy to guess';
const r = segs[0].getBoundingClientRect(), b = box.getBoundingClientRect();
for (let i = 0; i < 16; i++) { // sparks fly out of the first segment
const s = document.createElement('span'); s.className = 'spark';
s.style.left = (r.left - b.left + Math.random() * r.width) + 'px'; s.style.top = '3px';
box.append(s);
const a = -Math.PI * (.15 + .7 * Math.random()), v = 90 + 140 * Math.random();
s.animate([{ transform: 'translate(0,0)', opacity: 1 },
{ transform: `translate(${Math.cos(a) * v * .8}px, ${Math.sin(a) * v * .8 + 150}px)`, opacity: 0 }],
{ duration: 600 + 400 * Math.random(), easing: 'cubic-bezier(.2,.6,.4,1)' }).onfinish = () => s.remove();
}
setTimeout(() => { box.classList.remove('sputter'); form.classList.remove('shake'); input.value = ''; this.light(0, HUE); input.focus(); }, 900);
},
};
input.addEventListener('input', () => {
const pw = input.value;
tube.light(score(pw), HUE);
});
form.querySelector('.reveal').addEventListener('click', () => {
input.type = input.type === 'password' ? 'text' : 'password';
});
form.addEventListener('submit', e => {
e.preventDefault();
const pw = input.value;
if (score(pw) < 3) tube.sputter();
else form.querySelector('.go').textContent = 'Password saved'; // a real server request goes here
});
tube.light(0, HUE);
</script>
Type 12345 and press Enter, then try Neon#42lamp.
What you can change
Change a number, save, and reload the page to see the difference.
RULES4 checksWhat makes a password strong. Each rule that passes lights one more segment. Add or remove regexes to change the policy.
HUE4 colorsNeon color for 1, 2, 3 and 4 passed rules. Any hex colors work, the whole card glows in the current one.
< 3in submitHow many rules must pass before the form accepts the password. Lower it to be less strict.
Add it to your site
Put it on your sign up or change password screen.
CSS
Paste into your stylesheet, or inside a <style> tag in <head>.
/* --glow is set by the script to the current neon color, everything lit by the tube reads it */ .neon-form { --glow: 255, 77, 94; --light: 0; position: relative; box-sizing: border-box; width: min(380px, 92vw); padding: 26px 24px 24px; border-radius: 26px; color: #F3F5F8; background: radial-gradient(120% 70% at 50% 62%, rgba(var(--glow), calc(var(--light) * .22)), transparent 60%), linear-gradient(#12161D, #0C0F14); border: 1px solid rgba(var(--glow), calc(.08 + var(--light) * .35)); transition: border-color .25s ease; } /* the outer glow lives on its own layer so only its opacity animates, not a repainted box-shadow */ .neon-form::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: 0 0 70px rgba(var(--glow), .35); opacity: var(--light); transition: opacity .25s cubic-bezier(.23, 1, .32, 1); } .neon-form h2 { margin: 0; font-size: 21px; letter-spacing: -.02em; } .neon-form .rules { margin: 4px 0 18px; font-size: 13px; color: #7A8290; } .neon-field { position: relative; } .neon-field input { width: 100%; box-sizing: border-box; height: 48px; padding: 0 44px 0 16px; border-radius: 12px; outline: none; background: #080A0E; color: #F3F5F8; font: 500 17px Menlo, monospace; border: 1px solid rgba(var(--glow), calc(.18 + var(--light) * .45)); } .neon-field button { position: absolute; right: 8px; top: 8px; width: 32px; height: 32px; border: 0; background: none; color: #7A8290; cursor: pointer; } .neon-form.shake .neon-field { animation: shake .45s cubic-bezier(.23, 1, .32, 1); } @keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } } /* the tube: four glass segments, the lit ones glow in the current color */ .tube { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 6px 8px; } .tube i { height: 9px; border-radius: 9px; background: #10141A; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); transition: background .08s, box-shadow .08s; } .tube i.on { background: rgb(var(--glow)); box-shadow: 0 0 5px rgba(var(--glow), .9), 0 0 16px rgba(var(--glow), .5), 0 0 38px rgba(var(--glow), .35), inset 0 2px 0 rgba(255,255,255,.5); } .tube i.ignite { animation: ignite .22s steps(1); } @keyframes ignite { 0%, 40%, 80% { opacity: .15; } 20%, 60%, 100% { opacity: 1; } } .tube.sputter i.on { animation: sputter .5s steps(1) forwards; } @keyframes sputter { 0%, 30%, 55% { opacity: 1; filter: brightness(1.3); } 15%, 45%, 70% { opacity: .05; } 100% { opacity: 0; } } .spark { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #FFE3C4; box-shadow: 0 0 8px #FF6A4D; pointer-events: none; } .neon-label { min-height: 18px; margin: 0 6px 14px; font-size: 13px; font-weight: 600; color: rgb(var(--glow)); } .neon-form .go { width: 100%; height: 44px; border: 0; border-radius: 12px; font: 650 15px system-ui, sans-serif; cursor: pointer; background: #1A1F27; color: #8A93A1; transition: background .2s ease, color .2s ease, transform .16s cubic-bezier(.23, 1, .32, 1); } .neon-form .go:active { transform: scale(.97); } .neon-form.strong .go { background: rgb(108, 235, 217); color: #03201C; box-shadow: 0 0 26px rgba(108, 235, 217, .5); } @media (prefers-reduced-motion: reduce) { .tube i.ignite, .tube.sputter i.on, .neon-form.shake .neon-field { animation: none; } }HTML
Put it where the effect should appear on your page.
<form class="neon-form" novalidate> <h2>Create a password</h2> <p class="rules">10+ characters, a capital, a digit, a symbol</p> <div class="neon-field"> <input id="pw" type="password" autocomplete="new-password" aria-describedby="neon-label" placeholder="Type a password"> <button type="button" class="reveal" aria-label="Show password"> <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12Z"/><circle cx="12" cy="12" r="3"/></svg> </button> </div> <div class="tube" aria-hidden="true"><i></i><i></i><i></i><i></i></div> <div class="neon-label" id="neon-label" aria-live="polite"></div> <button class="go" type="submit">Continue</button> </form>JavaScript
Paste right before the closing </body> tag, inside <script></script>.
// the rules that make a password strong, and the neon color for 1, 2, 3 and 4 of them const RULES = [/.{10,}/, /[A-Z]/, /\d/, /\W/]; const HUE = ['#FF4D5E', '#FF9F43', '#FFD166', '#6CEBD9']; const LABELS = ['', 'Weak', 'Getting there', 'Almost', 'Strong password']; const score = pw => RULES.filter(r => r.test(pw)).length; const form = document.querySelector('.neon-form'); const input = form.querySelector('#pw'); const label = form.querySelector('.neon-label'); const segs = [...form.querySelectorAll('.tube i')]; const hex = h => [1, 3, 5].map(i => parseInt(h.slice(i, i + 2), 16)).join(', '); const tube = { lit: 0, light(n, hue) { form.style.setProperty('--glow', hex(hue[Math.max(0, n - 1)])); form.style.setProperty('--light', n / 4); segs.forEach((s, i) => { const on = i < n; if (on && i >= this.lit) { s.classList.remove('ignite'); void s.offsetWidth; s.classList.add('ignite'); } s.classList.toggle('on', on); }); this.lit = n; form.classList.toggle('strong', n === 4); label.textContent = LABELS[n]; }, sputter() { const box = form.querySelector('.tube'); box.classList.add('sputter'); form.classList.add('shake'); label.textContent = 'Too easy to guess'; const r = segs[0].getBoundingClientRect(), b = box.getBoundingClientRect(); for (let i = 0; i < 16; i++) { // sparks fly out of the first segment const s = document.createElement('span'); s.className = 'spark'; s.style.left = (r.left - b.left + Math.random() * r.width) + 'px'; s.style.top = '3px'; box.append(s); const a = -Math.PI * (.15 + .7 * Math.random()), v = 90 + 140 * Math.random(); s.animate([{ transform: 'translate(0,0)', opacity: 1 }, { transform: `translate(${Math.cos(a) * v * .8}px, ${Math.sin(a) * v * .8 + 150}px)`, opacity: 0 }], { duration: 600 + 400 * Math.random(), easing: 'cubic-bezier(.2,.6,.4,1)' }).onfinish = () => s.remove(); } setTimeout(() => { box.classList.remove('sputter'); form.classList.remove('shake'); input.value = ''; this.light(0, HUE); input.focus(); }, 900); }, }; input.addEventListener('input', () => { const pw = input.value; tube.light(score(pw), HUE); }); form.querySelector('.reveal').addEventListener('click', () => { input.type = input.type === 'password' ? 'text' : 'password'; }); form.addEventListener('submit', e => { e.preventDefault(); const pw = input.value; if (score(pw) < 3) tube.sputter(); else form.querySelector('.go').textContent = 'Password saved'; // a real server request goes here }); tube.light(0, HUE);
Connect it to your backend
In the submit handler, the else branch is where your real request goes. Send the password there instead of changing the button text.
Good to know
- Works without JavaScript libraries, the glow is plain CSS box-shadow driven by one variable, --glow.
Tilda, Webflow, WordPress
Press Copy all code at the top and paste it into one HTML block.
Add block, Other, T123 HTML code. Paste and save. Check the published page, the editor preview does not run scripts.
Add panel, Embed. Paste, then Save & Close. Custom code runs on the published site.
Add block, Custom HTML. Paste and press Update.



