Japanese castles were built during the feudal period (approximately from 1185 to 1867) and particularly in the 16th and early 17th centuries, during and just after the Japanese civil war. All were built in a similar defensive style, with a castle keep rising on 3, 4 or 5 storeys. Most of them were painted white, or occasionally black, or black and white.
It is almost impossible to know exactly how many castles there has been in the whole of Japan's history. Some believe that there could have been up to 40,000 castles before the Meiji restoration, which seems rather unlikely. All depends on what can be called a castle, as some were no bigger than an average house, but with the architectural appearance of a castle.
Nowadays, there are about 50 castles left in Japan, including the ruins and reconstructions. Among them, only 12 original castles are still standing.
The original castles
Here is a list of the remaining original castles with the first date of construction and last time the castle was rebuilt in feudal times (as opposed to modern ferro-concrete reconstructions).
Note that Maruoka castle is considered as an original, even though it was destoyed by an earthquake in 1955, as the original materials were used for its reconstruction.