Onmyōdō (?, also In'yōdō, lit. ‘The Way of Yin and Yang’) is a traditional Japanese esoteric cosmology, a mixture of natural science and occultism. It is based on the Chinese philosophies of Wu Xing (five elements) and Yin and yang, introduced into Japan at the beginning of the 6th century. It was accepted as a practical system of divination. These practices were influenced further by Taoism, Buddhism and Shintoism, and evolved into the system of onmyōdō around the late 7th century. Onmyōdō was under the control of the imperial government, and later its courtiers, the Tsuchimikado family until the middle of the 19th century, at which point it became prohibited as superstition.
In the 5th and 6th centuries, the principles of yin-yang and the Five Elements were transmitted to Japan from China along with Buddhism and Confucianism. Yin-yang and the Five Elements, as well as the divisions of learning to which they were linked – astronomy, calendar-making, the reckoning of time, divination, and studies based on observation of nature – were amalgamated into fortune telling. This process of judging auspicious or harmful signs present in the natural world was accepted into Japanese society as a technique for predicting good or bad fortune in the human world. Such techniques were known mostly by Buddhist monks from mainland Asia who were knowledgeable in reading and writing Chinese. Over time demand from members of the imperial court who believed that onmyōdō divination would be helpful in decision-making made it necessary for the laity to perform the art, and onmyōji began to appear around the middle of the 7th century.