thumb|Flag of San Marino on a [[boat in Spain.]]
The national flag of San Marino is formed by two equal horizontal bands of white (top) and light blue with the national coat of arms superimposed in the center; the coat of arms has a shield (featuring three towers on three peaks) with a closed crown on top, flanked by an oak and laurel wreath, with a scroll below bearing the word LIBERTAS (Freedom). The two colours of the flag represent peace (white) and liberty (light blue).
Although the Law on the flag and coat of arms of San Marino from 22 July 2011 refers only to the "official flag" of the republic, a de facto civil flag, which omits the coat of arms, can sometimes be seen flying. Some official sources of San Marino suggest that the civil flag is actually the bicolour with the coat of arms of the specific city it is used in, instead of the national one.
The national ensign of San Marino is identical to the state flag.
San Marino's municipalities all have flags that are very similar to San Marino's national flag. These flags all contain a shield-like emblem on the horizontal white and blue bicolour. Closest to the hoist of these flags is the name of the municipality written vertically.
History
thumb|The San Marino flag behind the [[Statua della Libertà, 2009. It shows a pre-2011 standardisation flag]]
The oldest attested standard of the republic dates back from 4 September 1465, when it was commissioned from a manufacturer in Florence, allegedly composed of a tricolour of gold, white and "alessandrino" (thought to be purple, recently re-interpreted as a shade of azure).
In 1797, most likely influenced by the wave of reforms in France, the Supreme Council of the Republic commissioned a white and blue cockade, which, coincidentally or not, was identical to the one used by the French revolutionaries.
The decree of 6 April 1862 standardized the coat of arms, but did not mention the flag.
A 2:3 proportion can be used internationally and/or when specifically requested. In this case, the coat of arms' width is of the flag's length, and the center of the cross on the top of the crown will be at of the flag's height below the upper edge.
The colours of the flag are officially prescribed as follows:
