Sudoku is one of a large variety of logic-based number-placement puzzles. The Magic Squares puzzle is the first known number-placement puzzle. The simplest Magic Square puzzle consists of a 3x3 grid (of 9 cells). The goal of the puzzle is to place numbers in the cells of the square such that the sum of the number in each row, column and two diagonals are the same number, called the magic number.

Magic Squares have a long history, dating back to at least 190 BCE in China. At various times, they have acquired magical or mythical significance, and have appeared as symbols in works of art.

According to Chinese legend, the first Magic Square was discovered by the Emperor Yu the Great (c. 2123 – 2025 BC) when a magical turtle emerged from the water with the curiously unnatural Lo Shu pattern on its shell: circular dots representing the integers 1 through 9 arranged in a three-by-three grid. This pattern is called the “Lo Shu Square”. The Lo Shu is part of the legacy of ancient Chinese mathematical and divinatory traditions. The Lo Shu Magic Square was an important model for time and space, and served as a basis for city planning, tomb design, and temple design.

Along the Silk Road, the Magic Square has travelled from China to the rest of Asia, and from there to Egypt, where they were included in clothes and ornaments as talismans. Sabian mathematician, physician, astronomer, and translator Thabit ibn Qurrah, who lived in Baghdad in the second half of the ninth century, is credited with introducing the Magic Square to the Western World.

In 1514, Germany's famous Renaissance artist Albrecht Dürer created the copperplate engraving named "Melancholia I", which contained the first magic square published in Europe.

In 1750, Benjamin Franklin, a Founding Father of the United States, constructed the 8×8 semi magic square having magic constant 260. Describing his invention in 1771, Franklin stated, "I was at length tired with sitting there to hear debates, in which, as clerk, I could take no part, and which were often so unentertaining that I was induc'd to amuse myself with making magic squares or circles" (Franklin 1793).

The Magic Squares have never lost their mystical or divine essence. A Spanish architect, Antonio Gaudí, known as the greatest exponent of Catalan Modernism, incorporated into the facade of his whimsical Basílica de la Sagrada Família a Pseudo-Magic Square with a magic constant of 33, the age of Christ.

Another famous type of Magic Square is the Sator Square (or Rotas Square), which is a word square containing a five-word Latin palindrome (a number or phrase which reads the same backward as forward). The oldest datable representation of the Sator Square was found in the ruins of Pompeii.

The puzzle that we now know as Sudoku was mainly created by the great Swiss mathematician Leonhard Euler. Euler developed the basics of 'Sudoku' which he called 'Graeco-Roman Squares' or Latin Squares. A Latin square is an n × n grid filled with n different symbols, each occurring exactly once in each row and exactly once in each column. Euler published the general theory of Latin squares in 1782. The Sudoku puzzles are a special case of Latin squares; any solution to a Sudoku puzzle is a Latin square.

Euler’s research has been used by mathematicians and scientists, but his puzzle was not taken up until late 1919th century, when French puzzle setters began experimenting with removing numbers from magic squares, and the number puzzles appeared in newspapers. In 1895, French newspapers published a partially completed 9×9 magic square with 3×3 sub-squares which was almost a modern Sudoku. These weekly puzzles were a feature of French newspapers for about a decade but then disappeared.

The modern Sudoku was designed by Howard Garns, a 74-year-old retired architect and freelance puzzle constructor from Indiana, and first published in 1979 by Dell Magazines. Garns died in 1989 before getting a chance to see his creation become a worldwide phenomenon.

The puzzle was popularized in 1986 by the Japanese puzzle company Nikoli, under the name Sudoku. The name Sudoku consists of the Japanese characters Su (meaning 'number') and Doku (meaning 'single'). In 1997, a retired Hong Kong judge Wayne Gould, then in his early 50s, saw a Sudoku puzzle in a Japanese bookshop. Over six years he developed a computer program to produce puzzles quickly. He promoted Sudoku to The Times in Britain, which launched it on November 12th, 2004. The first letter to The Times regarding Sudoku was published the following day on November 13th from Ian Payn of Brentford, complaining that the puzzle had caused him to miss his stop on the tube.

In the United States, the first newspaper to publish a Sudoku puzzle by Wayne Gould was The Conway Daily Sun (New Hampshire), in 2004.