A fully-featured, mobile-optimized Tetris game built with pure HTML5, CSS3, and JavaScript. Play the classic block-stacking puzzle game on any device with smooth touch controls and beautiful animations.
- 🎯 Classic Tetris Gameplay - All 7 authentic Tetris pieces (tetrominoes)
- 📱 Mobile Optimized - Responsive design that works perfectly on phones and tablets
- 👆 Touch Controls - Intuitive swipe gestures and on-screen buttons
- ⌨️ Keyboard Support - Full desktop keyboard controls
- 🎨 Beautiful UI - Modern gradient design with smooth animations
- 📊 Scoring System - Classic Tetris scoring with level progression
- 🔄 Next Piece Preview - See what's coming next
- ⚡ Progressive Difficulty - Game speed increases with levels
- 🏆 Statistics Tracking - Score, level, and lines cleared
Simply open tetris.html in any modern web browser:
- Download the
tetris.htmlfile - Double-click to open in your browser
- Click START GAME and play!
No installation, no dependencies, no build process required!
You can host this game anywhere that serves HTML files:
- GitHub Pages
- Netlify
- Vercel
- Any web server
Arrange falling blocks (tetrominoes) to create complete horizontal lines. When a line is completed, it disappears and you earn points. The game ends when blocks stack up to the top of the playing field.
- 👆 Tap - Rotate piece clockwise
- 👈 Swipe Left - Move piece left
- 👉 Swipe Right - Move piece right
- 👇 Swipe Down - Move piece down faster
- 🔘 On-Screen Buttons - Alternative touch controls
- ↻ Rotate
- ← ↓ → Directional movement
- ⬇ HARD DROP - Instantly drop piece to bottom
- ← Left Arrow - Move piece left
- → Right Arrow - Move piece right
- ↓ Down Arrow - Move piece down faster
- ↑ Up Arrow or Space - Rotate piece
- Enter - Hard drop (instant drop)
| Action | Points |
|---|---|
| Single Line | 40 × level |
| Double Lines | 100 × level |
| Triple Lines | 300 × level |
| Tetris (4 Lines) | 1200 × level |
| Hard Drop | 2 points per cell |
- Start at Level 1
- Advance one level for every 10 lines cleared
- Higher levels increase falling speed
- Maximum challenge at higher levels!
The game includes all 7 classic tetrominoes:
- I (Cyan) - The straight piece, perfect for Tetris!
- O (Yellow) - The square, stable and simple
- T (Purple) - The T-shape, versatile piece
- S (Green) - The S-shape, tricky to place
- Z (Red) - The Z-shape, mirror of S
- J (Blue) - The J-shape, great for corners
- L (Orange) - The L-shape, mirror of J
- HTML5 Canvas - For smooth graphics rendering
- CSS3 - Modern styling with gradients and animations
- Vanilla JavaScript - No frameworks or libraries needed
- Collision Detection - Precise piece boundary checking
- Wall Kicks - Smart rotation near walls and other pieces
- Responsive Canvas - Scales perfectly on any screen size
- Touch Events - Native touch gesture support
- Game Loop - RequestAnimationFrame for smooth 60 FPS
- State Management - Clean game state handling
Works on all modern browsers:
- ✅ Chrome/Edge (recommended)
- ✅ Firefox
- ✅ Safari (iOS and macOS)
- ✅ Samsung Internet
- ✅ Mobile browsers
This game is specifically optimized for mobile devices:
- Responsive Design - Adapts to any screen size
- Touch-Friendly - Large, easy-to-tap buttons
- No Zoom - Disabled pinch-to-zoom for better gameplay
- Portrait Mode - Perfect for one-handed play
- Smooth Gestures - Natural swipe controls
- Performance - Optimized for mobile CPUs
Want to customize the game? Here are some easy tweaks:
Edit the COLORS object in the JavaScript section:
const COLORS = {
I: '#00f0f0', // Cyan
J: '#0000f0', // Blue
L: '#f0a000', // Orange
// ... customize as you like!
};Modify the starting speed and level progression:
let dropInterval = 1000; // Starting speed (lower = faster)
level = Math.floor(lines / 10) + 1; // Change 10 to adjust level-up rateChange the grid dimensions:
const COLS = 10; // Board width
const ROWS = 20; // Board heightFeel free to fork this project and add your own features:
- 🎵 Sound effects and music
- 🎨 Different themes
- 👻 Ghost piece (preview where piece will land)
- 💾 High score persistence
- 🏅 Achievements system
- 🎭 Different game modes
This project is open source and available for anyone to use, modify, and distribute.
Created with ❤️ as a demonstration of modern web game development.
Classic Tetris gameplay inspired by the original game created by Alexey Pajitnov.
None currently! If you find a bug, please report it.
Having issues? Here are some tips:
- Game won't start? Make sure JavaScript is enabled
- Controls not working? Try refreshing the page
- Touch not responsive? Ensure you're tapping directly on buttons or canvas
- Slow performance? Close other browser tabs
Enjoy playing Tetris! 🎮✨
Can you beat your high score?