A fully functional clone of the popular 2048 puzzle game built entirely with vanilla HTML, CSS, and JavaScript.
Tiles slide on a 4×4 grid when you press an arrow key. Two tiles with the same number merge into one when they collide, doubling their value. The goal is to create a tile with the number 2048.
- Desktop: Arrow keys or WASD
- Mobile: Swipe in any direction
- Each move spawns a new tile (90% chance of 2, 10% chance of 4)
- Your score increases by the sum of all merged tiles each turn
- Smooth animations — CSS transitions for tile movement, keyframe animations for tile spawns and merges
- Score persistence — Best score saved to
localStorage - Win/loss detection — Notifies on reaching 2048 with a "Keep Going" option; ends when no moves remain
- Responsive — Adapts layout and tile sizing for mobile viewports
- Touch support — Swipe gestures for mobile play
- Zero dependencies — No frameworks, no libraries, no build step
├── index.html — Game markup
├── style.css — Visual design, layout, and animations
├── script.js — Game engine, DOM rendering, and event handling
└── README.md — Project documentation
Clone the repo and open index.html in any modern browser:
git clone https://github.com/burny143/2048-game.git
cd 2048-game
start index.htmlNo server or build tools required.
MIT