Select your skill level to see appropriate puzzles. Try to solve each puzzle by finding the best move!
Lichess #jbwGi - Back-rank mate: Black plays Rb1, White must defend with Re1
Lichess #RLHH3 - White plays Ra7, black must respond Rd1+, then Kc2 and Ne3#
Lichess #diRlH - Black plays Kf8, White responds Ba3 to control c5
Lichess #oqrBK - Black plays Kg5, White responds Rg4+ then Rh1#
Lichess #BveME - White plays Rc5, Black responds Rd1+, then Kf2 and Rf1#
Lichess #sYcXL - White plays Rxf2, Black responds Qxf2+, then Kh2 and Qg2#
Lichess #qGdZQ - White plays Kf4, Black responds Qh2+, then g3 and Qxg3#
Lichess #nR6zG - Master vs Master: White plays Ke1, Black responds Qe3+, then Kd1 and Bb3#
Lichess #U5No7 - Attraction pattern: Black plays ...Rxf4, White Qxh8+, then Kf7, g6+, Kg6, and Qh5#
Lichess #rfaGy - White plays Bb4, Black responds Rxf2+, then Kg1, Rg2+, Kf1, and Rxf2#
White to move and deliver checkmate. The black king is trapped by its own pawns on the back rank. Solution: Re8#
Lichess #NOb2c (ELO 900) - Black plays ...Qxd4, White responds Ne6, then Kf6, and Nxd4
Lichess #sTLMK (ELO 1260 Master Game) - Black plays ...Qxf6, White Re8+, then Kg7, and Nh5#
Lichess #fOtTP (ELO 1050 Master Game) - White plays Nd4, Black responds ...Bxa2, then Nxa2, and ...Qxd6
This board automatically rotates when it's black's turn. Try making moves to see the flip!
No solution defined - free play mode. Make any legal moves you want!
This puzzle accepts multiple correct solutions! After Re1, both Qh5 and Qf3 lead to checkmate.
<div class="chess-puzzle"
data-solution="f1e1,e5e4,d1h5|f1e1,e5e4,d1f3">
<!-- Use pipe | to separate alternative solutions -->
</div>
When you make a wrong move, Stockfish shows you why it's wrong by playing its best counter-move with a red arrow! Try making a wrong move to see it in action.
<div class="chess-puzzle"
data-stockfish-enabled="true"
data-stockfish-depth="10"
data-stockfish-show-arrow="true">
<!-- Stockfish will show counter-moves with red arrows -->
</div>
Widgets now support multiple languages! Try these puzzles in English and German.
<div class="chess-puzzle"
data-lang="de"> <!-- German language -->
</div>
The widget now includes external state management with event tracking and optional wrong move retention for deeper analysis!
Watch real-time events as you solve this puzzle. The console below shows all state changes and move attempts.
Lichess Puzzle #1400 ELO - Mate in 2, Middlegame Fork
Try making a wrong move! The position will be retained with a question mark indicator. Use the "Undo Wrong Move" button to continue.
Lichess Puzzle #1400 ELO - Mate in 2, Middlegame Fork
Here's how to subscribe to events programmatically:
// Get the widget state instance
const puzzle = document.getElementById('my-puzzle').widgetState;
// Subscribe to all state changes
puzzle.on('stateChange', ({ previous, current, metadata }) => {
console.log(`State changed: ${previous} β ${current}`);
});
// Subscribe to specific events
puzzle.on('wrongMove', ({ move }) => {
console.warn(`Wrong move: ${move}`);
});
puzzle.on('puzzleSolved', () => {
console.log('Congratulations! π');
});
// Get current state
const currentState = puzzle.getState(); // 'not_started' | 'in_progress' | 'wrong_move' | 'solved'
// Get state history
const history = puzzle.getStateHistory();
To add a chess widget to your website, simply include the CSS and JavaScript files, then add a div with the appropriate data attributes:
<!-- Include the widget files -->
<link rel="stylesheet" href="chess-widget.min.css">
<script src="chess-widget.min.js"></script>
<!-- Create a puzzle -->
<div class="chess-puzzle"
data-fen="r1bqkbnr/pppp1ppp/2n5/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 2 3"
data-solution="d2d4,e5d4,c2c3"
data-width="400">
</div>
data-fen: The chess position in FEN notation (required)data-solution: Solution moves - comma-separated, use "|" for alternative paths (optional, enables puzzle mode)data-lang: Language code - "en" (English, default) or "de" (German) (optional)data-width: Board width in pixels (optional, default: 400)data-auto-flip: Auto-rotate board for black's turn (optional, set to "true" to enable)data-orientation: Fixed orientation - "white" or "black" (optional, overrides auto-flip)data-premove-enabled: Play first solution move automatically (optional, for Lichess imports)data-stockfish-enabled: Enable Stockfish counter-move feedback (optional, set to "true")data-stockfish-depth: Stockfish analysis depth 1-20 (optional, default: 12)data-stockfish-timeout: Max API wait time in ms (optional, default: 2000)data-stockfish-cache-enabled: Enable localStorage caching (optional, default: true)data-stockfish-show-arrow: Show red arrow for counter-move (optional, default: true)data-expose-state-events: Enable external state tracking and events (optional, default: true)data-retain-wrong-moves: Keep wrong moves visible until manual undo (optional, default: false)The widget is completely standalone with all dependencies (chessground and chess.js) bundled - no CDN calls required!