Collection of free JavaScript Snake game code examples from codepen and other resources. Update of February 2020 collection. 6 new items.

Demo image: Vanilla JS Snake

Author

  • F A R I A T

Made with

  • HTML / CSS / JS

About a code

Vanilla JS Snake

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Responsive: yes

Dependencies: font-awesome.css

Demo image: Fading Snake

Author

  • Hunor Marton Borbely

Made with

  • HTML / CSS / JS

About a code

Fading Snake

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: -

Demo image: Snake Game

Author

  • Sayeed Markus

Made with

  • HTML / CSS / JS

About a code

Snake Game

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Responsive: no

Dependencies: -

Demo image: Pixelated Snake Game

Author

  • Anish Shamarao

Made with

  • HTML / CSS / JS

About a code

Pixelated Snake Game

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Responsive: yes

Dependencies: jquery.js

Demo image: AI Snake

Author

  • brezhart

Made with

  • HTML / CSS / JS

About a code

AI Snake

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

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Responsive: yes

Dependencies: nes.css

Demo image: Neon Snake

Author

  • Sebastian Opperman

Made with

  • HTML / CSS (SCSS) / JS

About a code

Neon Snake

Neon snake game built on HTML5 Canvas.

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Responsive: no

Dependencies: -

Demo image: 16bit Snake Game

Author

  • Betkowski

Made with

  • HTML / CSS / JS

About a code

16bit Snake Game

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

Demo image: SN4KE

Author

  • Vincent

Made with

  • HTML / CSS (SCSS) / JS (Babel)

About a code

SN4KE

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Responsive: yes

Dependencies: -

Demo image: React Game: Snake

Author

  • Kyle Wetton

Made with

  • HTML / CSS (SCSS) / JS (Babel)

About a code

React Game: Snake

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Responsive: no

Dependencies: react.js, react-dom.js

Demo image: Snake

Author

  • Steve Gardner

Made with

  • HTML / CSS (SCSS) / JS (TypeScript)

About a code

Snake

A retro game of Snake with keyboard and touch controls.

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Responsive: no

Dependencies: jsfx.js, rx.js

Demo image: Snake Game - p5js

Author

  • Elena

Made with

  • HTML / CSS / JS

About a code

Snake Game - p5js

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

Demo image: Snake

Author

  • Derek Viets

Made with

  • HTML / CSS / JS

About a code

Snake

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Responsive: no

Dependencies: -

Demo image: Snake Game

Author

  • Jack Rugile

Made with

  • HTML / CSS / JS

About a code

Snake Game

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: -

Demo image: Snake Game With Obelisk.js

Author

  • Sebastian Faedo

Made with

  • HTML / CSS / JS

About a code

Snake Game With Obelisk.js

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

Demo image: Canvas Snake Game

Author

  • Max

Made with

  • HTML / CSS / JS

About a code

Canvas Snake Game

Found a nice script around the net. Pimped it a bit and got this result :) Hope you like it!

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Responsive: no

Dependencies: jquery.js

Demo image: Simple Snake Game

Author

  • Caio Paiola

Made with

  • HTML / CSS / JS

About a code

Simple Snake Game

HTML5 game.

Compatible browsers: Chrome, Edge, Firefox, Opera, Safari

Responsive: no

Dependencies: -