The hinomaru was widely used on military banners in the Sengoku period of the 15th and 16th centuries. During the Meiji Restoration, on February 27, 1870 (January 27, 3rd year of Meiji in the Japanese calendar), the flag was officially adopted as the civil ensign by Proclamation No. 57. The hinomaru was legally the national flag from 1870 to 1885, but Japanese law did not designate a national flag from 1885 to 1999 because with the modernization of the cabinet, all of the prior Council of States' declarations were abolished. Despite this, several military banners of Japan are based on the design of the hinomaru, including the infamous sun-rayed Naval Ensign. The hinomaru was used as a template to design other Japanese flags, and its use was severely restricted during the early years of the American occupation after World War II, although these restrictions were later relaxed.
Kimigayo is one of the world's shortest national anthems, with a length of 11 measures and 32 characters. Its lyrics are based on a Waka poem written in the Heian period (794–1185) and sung to a melody composed in the Meiji period (1868–1912). In 1869, John William Fenton, a visiting Irish military band leader, realized there was no national anthem in Japan, and suggested to Iwao Ōyama, an officer of the Satsuma Clan, that one be created. Ōyama agreed, and selected the lyrics.
The lyrics may have been chosen for their similarity to the British national anthem because of Fenton's influence. After selecting the anthem's lyrics, Ōyama then asked Fenton to create the melody. This was the first version of Kimigayo, which was discarded because the melody "lacked solemnity." In 1880, the Imperial Household Agency adopted the current melody of Kimigayo and was formally adopted as the national anthem by the government formally adopted Kimigayo as the national anthem in 1888. By 1893, Kimigayo was included in public school ceremonies due to the efforts of the then Ministry of Education. During the American occupation of Japan, there were no directives by the Supreme Commander of the Allied Powers to restrict use of Kimigayo by the Japanese government. However, only the score of Kimigayo was played during official ceremonies following the war; the lyrics were not sung.
Read more about this topic: Act On National Flag And Anthem (Japan)