FREE & OPEN SOURCE
HTML5 Games
Free 2048 Game — Single HTML File, No Ads
2048Zip: the classic sliding puzzle with score, best score, one-step undo and keep-playing mode. One file, embed it anywhere.
What it is
2048Zip is the classic 2048 sliding-tile puzzle in one self-contained HTML file. Slide tiles with arrow keys, WASD or swipes; equal tiles merge; reach 2048 — then keep playing for a higher score. Score and best score persist in localStorage, a one-step undo forgives misclicks, and the game state auto-saves so you can close the tab mid-run.
The engine is deliberately clean: one pure slideRow function handles merging (with correct no-chain-merge rules), and all four directions are derived from it by rotating the grid — which made it trivial to unit-test outside the browser.
No dependencies, no ads, no tracking. The original 2048 concept by Gabriele Cirulli is MIT-licensed, and so is this. Drop the file on any static host or embed it with an iframe.
The engine is deliberately clean: one pure slideRow function handles merging (with correct no-chain-merge rules), and all four directions are derived from it by rotating the grid — which made it trivial to unit-test outside the browser.
No dependencies, no ads, no tracking. The original 2048 concept by Gabriele Cirulli is MIT-licensed, and so is this. Drop the file on any static host or embed it with an iframe.
Server requirements & dependencies
- Any modern browser — that's the whole list
- Any static file host to publish it (or none: the file works from disk)
- To embed on a site: a plain <iframe> pointing at the file
- No server, no database, no build step, no dependencies, no network calls
How to install
1. Unzip. You get one file: index.html.
2. Put it anywhere — a folder on your website, GitHub Pages, Netlify, a USB stick — or just double-click it and play locally.
3. To embed it on an existing page: <iframe src="/2048zip/index.html" style="width:100%;height:800px;border:0"></iframe>
Best scores save automatically in the browser's localStorage.
2. Put it anywhere — a folder on your website, GitHub Pages, Netlify, a USB stick — or just double-click it and play locally.
3. To embed it on an existing page: <iframe src="/2048zip/index.html" style="width:100%;height:800px;border:0"></iframe>
Best scores save automatically in the browser's localStorage.
The prompt — build it yourself
Paste this into Claude and you'll get this product. This is the actual spec that produced the code above.
Paste this prompt into Claude to build this exact product:
What happened when we ran it: Claude produced the game in 207 lines. We extracted the engine and ran it through 14 Node unit tests — simple and double merges, the no-chain rule, gap sliding, all four directions on an asymmetric grid, score arithmetic and dead-board detection — all passed on the first run. Zero revisions.
Note: there is no demo restriction — the demo IS the full game, and the download is the same single file. The prompt is for reproducing (or remixing) the build yourself with your own Claude subscription.
Build the classic 2048 sliding puzzle as a SINGLE self-contained HTML file called 2048Zip (inline CSS/JS, no dependencies). Dark theme, amber accent, rounded tiles, works great on phones.
Engine (pure and testable): aslideRowfunction that slides one row left and merges equal neighbours exactly once per move (2,2,2,2 → 4,4 — no chain merges), returning the new row, points gained and whether anything moved. Derive all four directions from it by rotating the grid. ProvidecanMove(game-over detection) andaddTile(new 2 or 4 — 90/10 — in a random empty cell).
Game: 4×4 grid, score + best score (localStorage), one-step undo (button and U key), win overlay at 2048 with a keep-playing mode, game-over overlay, pop animation on the spawned tile, tile colors scaling with value. Controls: arrows, WASD and swipe. Auto-save the full state and resume on load.
Deliver the single HTML file with an MIT header crediting Gabriele Cirulli's original.
What happened when we ran it: Claude produced the game in 207 lines. We extracted the engine and ran it through 14 Node unit tests — simple and double merges, the no-chain rule, gap sliding, all four directions on an asymmetric grid, score arithmetic and dead-board detection — all passed on the first run. Zero revisions.
Note: there is no demo restriction — the demo IS the full game, and the download is the same single file. The prompt is for reproducing (or remixing) the build yourself with your own Claude subscription.
Reviews
Used Free 2048 Game — Single HTML File, No Ads? A star rating takes two seconds and helps others.
More builds
License: MIT — free for personal and commercial use, no warranty. Software is provided as is; review the code before running it in production (it's short enough to actually read).