A clean, secure, and user-friendly password generator built with vanilla JavaScript. This application generates cryptographically secure passwords with customizable options while maintaining privacy by never transmitting or storing generated passwords.
- Cryptographically Secure: Uses
crypto.getRandomValues()
for true randomness - Customizable Length: Generate passwords from 4 to 128 characters
- Character Set Control: Toggle uppercase, lowercase, numbers, and special characters
- Batch Generation: Create up to 20 passwords simultaneously
- Ambiguous Character Exclusion: Optional removal of confusing characters (0, O, l, 1, etc.)
- One-Click Copy: Copy passwords to clipboard with visual feedback
- Real-Time Strength Analysis: Visual password strength indicator with entropy calculation
- Client-Side Only: No data transmission or server communication
- No Storage: Passwords are never saved or logged
- Secure Context: Works best in HTTPS environments
- Memory Management: Clears sensitive data when possible
- Responsive Design: Works seamlessly on desktop and mobile
- Accessibility: Full keyboard navigation and screen reader support
- Dark Mode: Automatic dark/light theme support
- Settings Persistence: Remembers your preferences locally
- Real-Time Updates: Instant password generation as settings change
- Download or clone this repository
- Open
index.html
in a modern web browser - Start generating secure passwords immediately
# Clone the repository
git clone https://github.com/0x-Decrypt/password-generator.git
cd password-generator
# Serve locally (recommended for full functionality)
python -m http.server 8000
# or
npx serve .
# Open http://localhost:8000 in your browser
Visit the live demo: https://0x-Decrypt.github.io/password-generator
- Adjust the password length using the slider (4-128 characters)
- Select desired character types (uppercase, lowercase, numbers, symbols)
- Optionally exclude ambiguous characters
- Click "Generate Password" or press Space
- Click "Copy" to copy the password to your clipboard
- Batch Generation: Use the quantity slider to generate multiple passwords
- Strength Analysis: View real-time password strength and entropy
- Keyboard Shortcuts: Press Space anywhere to generate new passwords
- Settings Persistence: Your preferences are automatically saved
For maximum security, we recommend:
- Length: 16+ characters
- Character Types: All types enabled
- Exclude Ambiguous: Enabled for better usability
The application follows a modular architecture with clear separation of concerns:
src/
βββ modules/
β βββ characterSets.js # Character set management
β βββ passwordGenerator.js # Core generation logic
β βββ validator.js # Input validation
β βββ strengthAnalyzer.js # Password strength analysis
β βββ uiController.js # UI management
βββ utils/
β βββ clipboard.js # Clipboard operations
β βββ helpers.js # Utility functions
βββ styles/
β βββ main.css # Core styles
β βββ components.css # Component-specific styles
βββ app.js # Application initialization
- Minimal Code: Functions under 25 lines each
- Single Responsibility: Each module has one clear purpose
- Error Handling: Comprehensive validation and error management
- Accessibility: ARIA labels and keyboard navigation
- Performance: Optimized for speed and memory efficiency
- Uses Web Crypto API's
crypto.getRandomValues()
for secure randomness - No predictable patterns or sequences
- Proper entropy calculation and validation
- No Network Requests: Completely offline functionality
- No Data Storage: Passwords exist only in memory temporarily
- No Logging: No console logging of sensitive data
- Memory Clearing: Attempts to clear passwords from memory when possible
- Modern browser with Web Crypto API support
- HTTPS recommended for full clipboard functionality
- JavaScript enabled
The application includes comprehensive testing for all core functionality:
# Run tests (if you have a local server)
open tests/index.html
# Or run individual test files
open tests/passwordGenerator.test.html
open tests/validator.test.html
- Password generation algorithms
- Input validation
- Character set management
- Strength analysis
- UI interactions
- Error handling
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Follow the existing code style and architecture
- Ensure all functions remain under 25 lines
- Add tests for new functionality
- Update documentation as needed
- Minimal Code: Write the fewest lines necessary
- Descriptive Naming: Clear, self-documenting variable and function names
- Modular Design: Keep components small and focused
- Error Handling: Validate inputs and handle edge cases
- Accessibility: Maintain ARIA labels and keyboard support
- Update the README.md with details of changes
- Ensure all tests pass
- Make sure the code follows the style guidelines
- Create a detailed pull request description
This project is licensed under the MIT License - see the LICENSE file for details.
- Web Crypto API for secure random number generation
- Modern CSS features for responsive design
- Accessibility guidelines from WCAG 2.1
- Security best practices from OWASP
Browser | Version | Support |
---|---|---|
Chrome | 37+ | β Full |
Firefox | 34+ | β Full |
Safari | 10.1+ | β Full |
Edge | 79+ | β Full |
The application can be customized by modifying the constants in the source files:
// In characterSets.js
const MAX_PASSWORD_LENGTH = 128;
const MIN_PASSWORD_LENGTH = 4;
// In passwordGenerator.js
const MAX_PASSWORDS = 20;
const DEFAULT_ENTROPY_THRESHOLD = 50;
- Generation Speed: < 100ms for any password length
- Memory Usage: Minimal footprint with automatic cleanup
- Bundle Size: < 50KB total (uncompressed)
- No Dependencies: Pure vanilla JavaScript
Q: Clipboard copy doesn't work A: Clipboard API requires HTTPS. Use a local server or enable clipboard permissions.
Q: "Crypto API not available" error A: Use a modern browser and HTTPS connection. Some older browsers don't support Web Crypto API.
Q: Password strength seems low A: Try increasing length and enabling all character types. The analyzer uses strict security standards.
If you encounter any issues:
- Check browser console for error messages
- Verify you're using a supported browser
- Try in an incognito/private window
- Report issues with detailed reproduction steps
Built with β€οΈ for security and usability