Collection of free JavaScript snake game code examples

Welcome to our collection of JavaScript examples! In this meticulously curated compilation, we have assembled a diverse range of JavaScript code snippets that showcase the flexibility and power of this dynamic programming language.

Vanilla JS Snake

Vanilla JS Snake

Author:
F A R I A T | April 9, 2021
Made with:
HTML / CSS / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
font-awesome.css
Fading Snake

Fading Snake

Author:
Hunor Marton Borbely | November 5, 2020
Made with:
HTML / CSS / JS

About a code

No libraries, no preprocessors, no imports not even SVG or canvas. Just plain HTML, CSS, and JavaScript.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
no
Dependencies:
-
Snake Game

Snake Game

Author:
Sayeed Markus | September 5, 2020
Made with:
HTML / CSS / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
no
Dependencies:
-
Pixelated Snake Game

Pixelated Snake Game

Author:
Anish Shamarao | December 29, 2019
Made with:
HTML / CSS / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
jquery.js
AI Snake

AI Snake

Author:
brezhart | November 4, 2019
Made with:
HTML / CSS / JS

About a code

Can you win that AI snake? I don't think so.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
nes.css
Neon Snake

Neon Snake

Author:
Sebastian Opperman | May 12, 2019
Made with:
HTML / CSS (SCSS) / JS

About a code

Neon snake game built on HTML5 Canvas.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
no
Dependencies:
-
16bit Snake Game

16bit Snake Game

Author:
Betkowski | March 26, 2019
Made with:
HTML / CSS / JS

About a code

Use keyboard arrows or buttons. 1. Hitting walls is a no-no. 2. Don't eat yourself. 3. Traveling backwards is a no-no too. 4. Everytime you fail it's faster.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
no
Dependencies:
font-awesome.css, jquery.js
SN4KE

SN4KE

Author:
Vincent | February 10, 2019
Made with:
HTML / CSS (SCSS) / JS (Babel)

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-
React Game: Snake

React Game: Snake

Author:
Kyle Wetton | August 5, 2018
Made with:
HTML / CSS (SCSS) / JS (Babel)

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
no
Dependencies:
react.js, react-dom.js
Snake

Snake

Author:
Steve Gardner | March 20, 2018
Made with:
HTML / CSS (SCSS) / JS (TypeScript)

About a code

A retro game of Snake with keyboard and touch controls.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
no
Dependencies:
jsfx.js, rx.js
Snake Game - p5js

Snake Game - p5js

Author:
Elena | December 10, 2017
Made with:
HTML / CSS / JS

About a code

Eat the grey square. Don't hit the red borders or the snake body.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
no
Dependencies:
p5.js, p5.dom.js
Snake

Snake

Author:
Derek Viets | January 20, 2016
Made with:
HTML / CSS / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
no
Dependencies:
-
Snake Game

Snake Game

Author:
Jack Rugile | June 13, 2014
Made with:
HTML / CSS / JS

About a code

This is a basic snake game made with JavaScript for logic and CSS for rendering. Use the arrow keys or WASD to control the snake. You can loop through walls.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-
Snake Game With Obelisk.js

Snake Game With Obelisk.js

Author:
Sebastian Faedo | March 25, 2014
Made with:
HTML / CSS / JS

About a code

The movement is relative to the snake, so you use only left and right keys.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
no
Dependencies:
obelisk.js
Canvas Snake Game

Canvas Snake Game

Author:
Max | May 29, 2013
Made with:
HTML / CSS / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
no
Dependencies:
jquery.js
Simple Snake Game

Simple Snake Game

Author:
Caio Paiola | January 29, 2013
Made with:
HTML / CSS / JS

About a code

HTML5 game.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
no
Dependencies:
-

Discover Our Extensive Snippet Library

This heading suggests that your website provides a wide variety of snippets across different technologies, encouraging users to explore and use these resources for their development projects.

HTML Snippets.

Explore a collection of HTML snippets designed to streamline your web development process. From basic structures to complex elements.

CSS Snippets.

Discover powerful CSS snippets that help you style your web pages with ease. Whether you need layout solutions, animations

JavaScript Snippets.

Enhance your website's interactivity with our JavaScript snippets. From DOM manipulation to advanced algorithms

Bootstrap Snippets.

Leverage the power of Bootstrap with our collection of snippets. Quickly integrate responsive design components

Tailwind Snippets.

Speed up your development process with Tailwind CSS snippets. These utility-first CSS snippets enable you to

jQuery Snippets.

Simplify your JavaScript development with jQuery snippets. Easily perform common tasks like event handling, animations

React Snippets.

Build robust, component-based user interfaces with our React snippets. From state management to lifecycle methods,

Vue Snippets.

Streamline Vue.js development with our collection of snippets for creating components, managing state, and handling events.

Ready to set your Brand ablaze?

Let's craft a visual identity that ignites passion and loyalty. ✨