A castle in Italy with a mysterious octagonal shape is rumoured to have secret codes, with many bizarre theories about the number 8 surrounding it.

Built in the 13th century, Castel Del Monte (or castle of the mountain) was constructed by the Holy Roman Emperor Fredrick II in South Eastern Italy’s Apulia region.

This castle has a distinct style with eccentric features. It has an octagonal shape, with eight octagonal towers at each corner and there are eight rooms on each of the two floors, reports Mirror.

Its mathematical design has attracted scholars and mathematicians from all over the world, with the castle being rumoured to be built on measurements with hidden meanings that may hold secrets or codes.

The rooms are trapezoidal in shape and feature tiled floors with hexagonal and triangular tessellation, which is just another notch in the geometric perfection of this strange but beautiful building.

According to YouTube channelOrigins Explained , the castle was never intended as a defensive fortress, so it begs the question, why did the Holy Roman Emperor actually decide to build this castle?

Many scholars have found astronomical symbols inside that were intended to be hidden, and hundreds of years ago, the castle was said to have been hidden by a dense forest – meaning that it would be pretty difficult to find.

There are many legends concerning the creepy castle, including ghosts of servants and passing men, and even the soul of Fredrick II roaming the castle because he didn’t want to abandon his home.

Granted, this castle has seen a lot through its time, after the death of Fredrick II, it was used as a state prison in the late 13th century and a refuge during the plague. The US military even used it as a secret navigational aid station during World War Two.

The octagonal plan is the geometric shape closest to the circle, which is known as the figure of all that is heavenly, so that could be an explanation as to why.

Another explanation for the obsession with the number eight throughout the design, could be because the number eight represents infinity, and it's generally a very spiritual number.

But the codes? Well, we’ll never know unfortunately. After Fredrick’s death, a “Damnatio Memoriae'' was instructed, to destroy everything concerning this building, design drawings and any document related to it. We’ll just have to use our imagination, then.