Get your game on with this collection of JavaScript games. Featuring everything from time-honored classics like Snake and Tetris to new and innovative mini-games, each example is crafted with pure HTML, CSS, and JavaScript - perfect for learning, inspiration, or simply having fun.
45 JavaScript Games
SVG Path Zuma Marble Shooter
demo & codeThis is an SVG Path Zuma Marble Shooter. It replicates the classic ball-matching arcade mechanic using a combination of SVG geometric data and a custom DOM-based rendering engine. Its function is to provide a complete, interactive game loop where players fire colored marbles to create matches of three or more along a complex, winding track defined by an invisible SVG path.
Neon Vaporwave Pong Game
demo & codeThis is a Neon Vaporwave Pong Game (“CODEPONG 26”). It is a complete, browser-based arcade game rendered via the HTML5 Canvas 2D API. Its function is to provide a highly polished, playable experience that demonstrates advanced frontend techniques, including a custom physics engine, an adaptive AI opponent that gets harder as the game progresses, and programmatic audio synthesis for sound effects.
Interactive Board Game Prototype
demo & codeThis is an Interactive Board Game Prototype (“Wildfire”). It is a standalone, browser-based puzzle game where the player defends a “home” tile from procedurally generated “fire” tiles spreading across a 6x6 grid. It functions as an excellent study in grid mathematics, DOM-based state management, and turn-based game loops built entirely without canvas rendering or heavy game engine frameworks.
Interactive Sliding Grid Puzzle Game
demo & codeThis is an Interactive Sliding Grid Puzzle Game. It structures a multi-level spatial logic challenge entirely within the DOM. Its function is to demonstrate complex 2D state management, collision detection, and procedural grid generation without relying on the HTML Canvas API, utilizing standard HTML elements for interactive entertainment.
HTML5 Canvas Stick Hero Game
demo & codeThis is an HTML5 Canvas Stick Hero Game. It uses pure JavaScript and mathematical rendering to create an interactive 2D physics puzzle. The function is to demonstrate a continuous render loop controlled by user input timing, transforming simple mouse holds into spatial calculations.
Procedural 3D Endless Runner Game
demo & codeThis is a Procedural 3D Endless Runner Game. It utilizes Three.js to render a dynamically generated, infinite obstacle course. Its function is to deliver a complete, lane-based gameplay loop entirely within the browser. The environment and actors are constructed procedurally, eliminating external asset dependencies and ensuring instant execution.
Canvas Card Slicer Game
demo & codeModern web games often rely on bloated frameworks. This project demonstrates the raw capability of the native Canvas API combined with lightweight physics. It is a satisfying, tactile experience where the user’s cursor becomes a blade. By implementing a custom particle system and separating the collision logic (SAT.js) from the rendering, we achieve a high-performance arcade feel that runs smoothly even on modest hardware.
Stealth Pi Game
demo & codeWeb games often get bogged down in heavy engines. This project is a love letter to the raw power of the HTML5 Canvas API. It is a pure, dependency-free arcade experience (save for a tiny sound synthesizer) that pits player reflexes against mathematical precision. You aren’t just moving pixels; you are navigating a vector field, dodging a ray-casting collision detector that speeds up as you survive. It is tense, fast, and built on solid geometry.
3D Tilt Maze Game
demo & codeThis 3D Tilt Maze Game recreates the classic wooden labyrinth toy using web technologies. By combining CSS perspective with JavaScript keyboard events, it simulates a physical board that tilts to roll a ball. The game includes a rudimentary physics engine for ball movement and wall collision, complete with multiple levels generated from array maps.
Snake Game in Vanilla JS
A retro-styled, full-screen Snake game rendered on HTML5 Canvas. JavaScript manages the game loop, collision detection, and array-based movement logic, while CSS provides a neon arcade aesthetic.
See the Pen Snake Game in Vanilla JS.
Snakes and Ladders
A massive, full-stack client-side game simulation (Snakes & Ladders) driven by imperative Vanilla JavaScript/jQuery.
See the Pen Snakes and Ladders.
Rotating Puzzle
A complex puzzle where each image fragment can be flipped or rotated in any direction, challenging the player’s spatial reasoning to reconstruct the original picture.
See the Pen Rotating Puzzle.
Catblob 2
A full-featured browser game with retro aesthetics, procedural level generation, intelligent enemies, and a scoring system, running smoothly thanks to a combination of Canvas for static elements and DOM for dynamic content.
See the Pen Catblob 2.
DOM-Based Platformer with Gamepad API Support
A DOM-based platformer engine that constructs levels from numeric arrays, utilizing document.elementFromPoint for real-time collision detection and physics simulation. The JavaScript game loop manages gravity, gamepad support, and level transitions, while intricate CSS gradients and animations bring the tile-based world and character to life.
See the Pen DOM-Based Platformer with Gamepad API Support.
Vanilla JavaScript Minesweeper Game
This is a complete Minesweeper game built with vanilla JavaScript, featuring a recursive checktile function for game logic and a dynamic UI that is procedurally generated with a for loop. The modern, clean aesthetic is styled with SCSS and a themeable --main-color CSS variable, while a shake animation on game over adds a polished feel, creating a full-featured and engaging browser-based game.
See the Pen Vanilla JavaScript Minesweeper Game.
CORE Tower Defense Game
This tower defense-style game leverages an object-oriented class hierarchy with p5.Vector physics to create dynamic ball interactions, where core gameplay revolves around protecting a central orb from attacker waves using a reload-managed cannon.
See the Pen CORE Tower Defense Game.
Sliding Puzzle with GSAP Draggable and Tailwind CSS
An implementation of a sliding puzzle using GSAP Draggable - featuring a custom snap function for grid alignment and onThrowComplete logic that uses hitTest to determine move validity and trigger the swap animation.
See the Pen Sliding Puzzle with GSAP Draggable and Tailwind CSS.
Tilting Maze Game with Complex Physics
This maze puzzle is implemented using pure JavaScript and CSS 3D transforms which tilt the maze, creating the illusion of gravity and ball movement. The code features complex collision physics for balls hitting walls and “rolling” around corners with precise mathematical calculations.
See the Pen Tilting Maze Game with Complex Physics.
A Simple Platform Game Engine
The engine implements a lightweight game loop via requestAnimFrame for smooth rendering, featuring a scriptable and fully customizable map structure defined by a simple - easily modifiable - JavaScript object.
See the Pen A Simple Platform Game Engine.
Color Collision: A Dynamic Canvas Game
Vanilla JS game built with the Canvas API uses OOP principles for physics-based color-matching and implements dynamic difficulty scaling - gradually increasing ball velocity within an setInterval loop.
See the Pen Color Collision: A Dynamic Canvas Game.
JS Planet Defense Game
This pure Vanilla JS arcade game leverages the HTML Canvas API to render real-time projectile and enemy movement, utilizing sprites for an old-school look, and implements mouse-based aiming and firing for interactive defense against asteroids.
See the Pen JS Planet Defense Game.
Marble Labyrinth Game
This demo implements a tilt-controlled marble labyrinth using the HTML Canvas API for rendering and custom physics logic in vanilla JavaScript to handle sphere movement, gravity simulation, and collision detection with the static map geometry.
See the Pen Marble Labyrinth Game.
Path Finder Game with SVG
This minimalist path-finding game uses SVG elements for a scalable and responsive rendering of the board and connections. The core JavaScript logic includes the getDistance utility function to determine the nearest neighbor and manages dynamic level progression based on performance.
See the Pen Path Finder Game with SVG.
SUPERHOT 2D Game Clone
This 2D arcade prototype, built with the Phaser.io framework, implements the core ’time moves only when you move’ mechanic by dynamically scaling the game’s internal speed based on real-time player input, delivering a unique strategic shooter experience.
See the Pen SUPERHOT 2D Game Clone.
Tile-Based Copycat Game
This technical demo showcases a tile-based puzzle game built on the Diorama engine, leveraging the HTML Canvas API for rendering; smooth object movement is implemented via custom tweening utilities, such as Util.easeInOutQuad, with the retro-pixel aesthetic achieved using the CSS property image-rendering: pixelated;.
See the Pen Tile-Based Copycat Game.
Cheap AI Chess Game
A fully playable chess demo featuring an optional random AI engine written in TypeScript, complete with game state management, move validation, and adjustable autoplay speed, all within a modern frontend.
See the Pen Cheap AI Chess Game.
ASTEROIDS (Real-Time Rendering)
Built on a performant, real-time rendering loop with custom mathematical utilities, this demo features robust entity management and advanced damage mechanics that trigger dynamic particle effects on every impact.
See the Pen ASTEROIDS (Real-Time Rendering).
Canvasteroids Game
A dynamic Asteroids clone built on pure HTML Canvas, showcasing advanced vector graphics and utilizing manual pixel manipulation for realistic and high-impact particle explosions.
See the Pen Canvasteroids Game.
Victorious Game (Advanced AI)
Leverages a sophisticated AI decision tree for competitive fight-or-flight behavior, combined with precise barycentric collision detection to calculate shot-to-rocket impacts based on geometric area.
See the Pen Victorious Game (Advanced AI).
Next-Gen Tic-Tac-Toe Game (Shiny Edges)
Next-Gen Tic-Tac-Toe. The classic game with technical flair - features full accessibility (play with the keyboard!), a theme picker using localStorage, and a cool hover glow effect on the board using pure CSS.
See the Pen Next-Gen Tic-Tac-Toe Game (Shiny Edges).
Jeweled Game
This demo showcases a “match-three” game implementation in pure JavaScript, focusing on core game logic: detecting and clearing matches, generating “bomb” and “rainbow” power-ups, and handling board cascades. Technically, it illustrates how to manage complex game state without frameworks, using only JS, CSS, and GSAP for animations.
See the Pen Jeweled Game.
Lorde Hero Rhythm Game
This demo shows a music rhythm game with dynamic CSS animations and Web Audio API for interactive sound. It features responsive UI, real-time score calculation, and adjustable difficulty.
See the Pen Lorde Hero Rhythm Game.
Emoji Memory Match
This “Memory Match” game demo shows how to build a complete interactive game using pure JavaScript, including logic for randomizing elements, tracking pairs, and managing game state (score, board lock).
See the Pen Emoji Memory Match.
Flottenmanöver: A Battleship Game
This is a complete implementation of the game “Battleship” using pure JavaScript, HTML, and CSS. The code includes the logic for ship placement, hit detection, sinking ships, and managing turns for both the player and the computer. A notable feature is the use of Base64 images for ship sprites and their dynamic rendering on the game board.
See the Pen Flottenmanöver: A Battleship Game.
Tower of Hanoi Game in Pure JavaScript
A pure JavaScript implementation of the classic puzzle, this demo highlights a robust game engine with responsive sizing, a dynamic move counter, and a winning state with a custom canvas animation. It’s a great example of building an entire application without frameworks.
See the Pen Tower of Hanoi Game in Pure JavaScript.
Doodle Jump Clone with HTML5 Canvas
A complete HTML5 Canvas implementation of Doodle Jump featuring sprite-based animations, realistic physics with gravity and acceleration, and procedurally generated platforms with different behaviors.
See the Pen Doodle Jump Clone with HTML5 Canvas.
Pacman Game with HTML5 Canvas and JavaScript
A faithful implementation of the classic Pacman game using vanilla JavaScript and HTML5 Canvas, featuring smooth sprite animation, collision detection, and original game mechanics with multiple ghost AI behaviors.
See the Pen Pacman Game with HTML5 Canvas and JavaScript.