The rules of the game are as follows.

In Tic Tac Toe, 2 players take turns adding their token (an X or a O) to a 3 x 3 (or N X N, for the more ambitious) grid until one player matches 3 (N) in a row in any direction.

Well, today we hand-picked the ever popular Tic Tac Toe game code examples.

Here is 16 Best Tic Tac Toe Games with JavaScript code examples.

1.Tic Tac Toe (Vanilla JS)

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
Vasanth Krishnamoorthy

Demo


2.TIC TAC TOE BOARD

Pure JavaScript tic tac toe board.

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
Sanket Vaghela

Demo


3.TIC TAC TOE

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
Andrew Biddle

Demo


4.TIC TAC TOE

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
Yago Estévez

Demo


5.UNBEATABLE TIC TAC TOE

A twist on tic tac toe, using emoji icons to represent your symbol, and an AI that talks back making fun of you when you lose. Note: you can’t win at this game as it is using a min max algo. There is a bug however that if exploited can “help” you win, but that’s just cheating.

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
Dovydas

Demo


6.PRETTY TIC TAC TOE

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
Emily Goldfein

Demo


7.TIC TAC TOE

This is the tic tac toe game. You can play against a human player or computer which has AI build based on minimax algorithm.

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
r00bal

Demo


8.TIC TAC TOE MINIMAX ALGORITHM AI

Tic Tac Toe game. You play against the computer, driven by the minimax algorithm.

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
Raphael Pora

Demo


9.TIC TAC TOE

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
Tim Rijkse

Demo


10.TIC TAC TOE GAME

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
Mohammed ERRAYSY

Demo


11.IMPOSSIBLE TIC-TAC-TOE

A simple game of tic-tac-toe. It is impossible to win, best you can do is tie!

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
Epic

Demo


12.TIC-TAC-TOE

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
Bruce Young

Demo


13.TIC-TAC-TOE IN JAVASCRIPT

A simple Tic-tac-toe game in JavaScript.

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
Jan Schreiber

Demo


14.TIC-TAC-TOE

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
zoite

Demo


15.TIC TAC TOE GAME

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
tushar bandal

Demo


16.TIC-TAC-TOE

Tic-Tac-Toe created using HTML, CSS and Javascript.

Made with

1
2
3
Html
Css/SCSS
Javascript

Author

1
Armando Amador

Demo