A zero-dependency, single-file Sudoku solver built with pure HTML, CSS & JavaScript.
Instant solve via backtracking algorithm · Keyboard navigation · Fully responsive · No build step.
- Instant solver - backtracking algorithm solves any valid puzzle in milliseconds
- 3 built-in puzzles - Easy, Medium, and Hard difficulties to get started immediately
- Manual entry - fill in your own puzzle from a newspaper, app, or anywhere
- Conflict detection - validate the board and highlights conflicting cells in red
- Keyboard-first UX - arrow keys navigate cells, digits fill them, Backspace erases
- On-screen numpad - full touch support for mobile users
- Smart highlighting - selecting a cell highlights its row, column, and 3×3 box
- Animated solve - filled cells pop in with a staggered reveal animation
- No scroll design - entire UI fits within one viewport, no scrolling required
- Zero dependencies - single
index.htmlfile, no npm, no bundler, no framework
The solver uses a recursive backtracking algorithm:
- Scan the grid left-to-right, top-to-bottom for the first empty cell
- Try placing digits 1-9, checking row, column, and 3×3 box constraints
- Recurse into the next empty cell
- If no digit fits, backtrack and try the next candidate in the previous cell
- Repeat until the board is fully filled or declared unsolvable
isValid(board, row, col, num)
-> check row : no duplicate in board[row][0..8]
-> check col : no duplicate in board[0..8][col]
-> check box : no duplicate in the 3×3 region
Time complexity: O(9^m) where m = number of empty cells - optimized by early pruning at each step.
No install. No build. Just open it.
git clone https://github.com/manishkrmahato/sudoku.git
cd sudoku
open index.html # or double-click in your file explorerOr visit the Live Demo directly.
| Action | How |
|---|---|
| Select a cell | Click it |
| Enter a digit | Type 1-9 or use the on-screen numpad |
| Erase a cell | Backspace / Delete / 0 or the ✕ button |
| Navigate | Arrow keys |
| Load a puzzle | Pick a difficulty → click Load Puzzle |
| Solve | Click Solve |
| Check for errors | Click Validate |
| Start fresh | Click Clear |
sudoku/
└── index.html # Everything - layout, styles, and logic in one file
└── demo.gif # Demo recording for README
└── README.md
| Metric | Score |
|---|---|
| Performance | 100 |
| Accessibility | 100 |
| Best Practices | 100 |
| SEO | 100 |
Manish Kumar Mahato
B.Tech CSE · NIT Warangal
Built with pure HTML, CSS & JavaScript · No frameworks · No dependencies
