The flag of Hungary (Hungarian: Magyarország zászlója) is a horizontal tricolour of red, white and green. In this exact form, it has been the official flag of Hungary since October 1, 1957.
Today’s flag of Hungary stems from the national freedom movement before 1848 which climaxed in the Hungarian Revolution of 1848, which was not only a revolution against the monarchy and to constitute a republic, but also a national movement against the Habsburg Empire. Thus, the tricolour feature of the flag is based on the French flag and the ideas of French revolution, while the colours red, white and green were taken from the historical coat of arms. The coat of arms first appeared in the form, which is but for minor details basically the same as nowadays in the mid-15th century, marshalled from arms that first appeared in the late-12th and early-13th century as arms of the Árpáds, Hungary’s founding dynasty. According to other data, the recent form of the Hungarian tricolour had been already used from 1608 at the coronation of Mathias II of Hungary.
So the form of the Hungarian flag has its origins in the national republican movements of the 18th-19th century, while its colours are from the Middle Ages.
Folklore of the romantic period attributed the colours to virtues: red for strength, white for faithfulness and green for hope. Alternatively, red for the blood spilled for the fatherland, white for freedom and green for the land, for the pastures of Hungary. Wikipedia