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

Html
Css/SCSS
Javascript

Author

Vasanth Krishnamoorthy

Demo


2.TIC TAC TOE BOARD

Pure JavaScript tic tac toe board.

Made with

Html
Css/SCSS
Javascript

Author

Sanket Vaghela

Demo


3.TIC TAC TOE

Made with

Html
Css/SCSS
Javascript

Author

Andrew Biddle

Demo


4.TIC TAC TOE

Made with

Html
Css/SCSS
Javascript

Author

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

Html
Css/SCSS
Javascript

Author

Dovydas

Demo


6.PRETTY TIC TAC TOE

Made with

Html
Css/SCSS
Javascript

Author

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

Html
Css/SCSS
Javascript

Author

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

Html
Css/SCSS
Javascript

Author

Raphael Pora

Demo


9.TIC TAC TOE

Made with

Html
Css/SCSS
Javascript

Author

Tim Rijkse

Demo


10.TIC TAC TOE GAME

Made with

Html
Css/SCSS
Javascript

Author

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

Html
Css/SCSS
Javascript

Author

Epic

Demo


12.TIC-TAC-TOE

Made with

Html
Css/SCSS
Javascript

Author

Bruce Young

Demo


13.TIC-TAC-TOE IN JAVASCRIPT

A simple Tic-tac-toe game in JavaScript.

Made with

Html
Css/SCSS
Javascript

Author

Jan Schreiber

Demo


14.TIC-TAC-TOE

Made with

Html
Css/SCSS
Javascript

Author

zoite

Demo


15.TIC TAC TOE GAME

Made with

Html
Css/SCSS
Javascript

Author

tushar bandal

Demo


16.TIC-TAC-TOE

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

Made with

Html
Css/SCSS
Javascript

Author

Armando Amador

Demo