After Guatemala declared its independence on September 15, 1821, the provincial assembly convened by the government on May 10, 1823, decided to temporarily adopt a white flag with a red star in the center.
On August 21, 1823, the National Constituent Assembly of the United Provinces of Central America granted the new state a flag. The flag consisted of three horizontal stripes, blue at the top and bottom and white in the center, on which the coat of arms was depicted. When Costa Rica joined the Central American Republic on March 6, 1824, it adopted this flag.

On November 2, 1824, the flag of the United Provinces of Central America was approved, consisting of three horizontal stripes: blue, white and blue, with the coat of arms of the United Provinces in the center of the white stripe and the coat of arms of the state of Costa Rica in the lower blue stripe.
In 1840, the national flag returned to using a single coat of arms in the center, but the order of the stripes changed. Now the blue stripe was in the center, and the two white stripes were from top to bottom. This version of the flag was used for only two years, until 1842.
The current tricolor flag and the central motif of the coat of arms appeared during the reign of Dr. Jose Maria Castro in 1848.

The flag was a tricolor banner of five stripes placed horizontally in the following sequence: a red stripe, twice as wide as the others, in the center, between two white stripes, each followed by a blue stripe. The coat of arms of the Republic is embroidered in the center of the red stripe.
The concept and design of the current flag, which has been in use since this year, was developed by Mrs. Pacifica Fernández Orimuno, wife of the then Head of State, Dr. José María Castro Madríz, and was inspired by the flag of France.