Password Generator
Home
Snippets
Password Generator
HTML
CSS
JS
<div class="box"> <input type="text" id="pw" placeholder="Password" readonly /> <button onclick="gen()">Generate</button> </div>
body { height: 100vh; margin: 0; font-family: sans-serif; display: flex; justify-content: center; align-items: center; background: #f1f5f9; } .box { background: #fff; padding: 12px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); text-align: center; width: 220px; } input { width: 100%; padding: 6px; box-sizing: border-box; margin-bottom: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; } button { padding: 6px 12px; background: orangered; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; width: 100%; }
function gen() { const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*'; let pw = ''; for (let i = 0; i < 10; i++) pw += chars[Math.floor(Math.random() * chars.length)]; document.getElementById('pw').value = pw; }
Ad #1
Ad #2
Scroll to Top