Until 1912, there was no set design for the Stars and Stripes. And so, hidden in older versions of the flag, its makers laid hints of the country's history and quest for identity.

The US national anthem Oh, say! can you see by the dawn's early light / What so proudly we hailed at the twilight's last gleaming / Whose broad stripes and bright stars, through the perilous fight / O'er the ramparts we watched were so gallantly streaming? And the rockets' red glare, the bombs bursting in air / Gave proof through the night that our flag was still there / Oh say! does that star-spangled banner yet wave / O'er the land of the free and the home of the brave? Watch Andrew Graham-Dixon's Art of America

Aptly - given its national anthem is about the flag - the Stars and Stripes is a key part of America's identity. It hangs in classrooms and in courtrooms, on state buildings and suburban porches.

It has been the national flag since 1777. And the flag that inspired the anthem was enormous. Measuring 30 by 42 feet (9 x 12.8m), it was raised over Baltimore's Fort McHenry during the War of 1812. Its 15 broad stripes and 15 bright stars inspired Francis Scott Key to write The Star-Spangled Banner, the song that became the national anthem.

But for more than half the flag's 234-year history, there was no official design - the arrangement and appearance of the stars was up to the maker. And that, says art historian Andrew Graham-Dixon, makes it an artwork in a way other nations' flag are not.

"It's to do with this peculiar fact that they didn't standardise the design, so you could express different things within each flag," he says.

"Generally speaking, a flag is a flag - it's like a number plate or logo, it always stays the same. But in America it didn't, which left room for people to express their creativity or their bile or their sadness."

So what are the hidden messages in these notable flags?

New constellation

Image caption Star configuration was up to the maker

"The basic symbolism of the first flag was 13 stars in the form of a new constellation and 13 stripes. Both of those counts reflect the number of original colonies," says antique flag expert Jeff Bridgman.

Multiple stars forming a single constellation was symbolic of the colonies coming together to form a new nation, and stars were added as more states joined the union.

"But they never specified what that constellation was supposed to be."

With no official design until 1912, some flag-makers arranged the stars into one big star, as pictured, or in a circle, or in rows. And some replaced a state's star with its initial to show where their sympathies lay.

The many and varied designs encapsulate American individualism in flag form, says Graham-Dixon.

Northern anger

Image caption The portrait of Washington is thought to have been added at a later date

This Civil War era flag is a stark illustration of the north-south divide at this turbulent moment in American history.

The Green Mountain Boys was a nickname for a Vermont military unit. The flag is thought to have been made by a soldier's mother who used it to express her anger against the South, says Bridgman.

"There are only 20 stars here. There ought to be 34, 35 or, if it was the tail-end of the war, 36 stars.

"The maker has done something that Abraham Lincoln said specially not to do, which was remove the southern states from the flag during the war. This is what we call a southern-exclusionary star count."

He surmises that she had lost a son, or sons, in the conflict. "And so she said, 'No, those guys are out. I'm not going to include those stars in the flag when I make it.'"

Southern defiance

Media playback is unsupported on your device Media caption Jeff Bridgman shows a confederate cross hidden in the Stars and Stripes

This flag, made soon after the Civil War of 1861-65, comes from the defeated South.

Image caption The Confederate flag still flies in southern states

"The stars are configured in the southern cross buried in the design of this flag. That was a subtle way of displaying southern sympathies," says Bridgman.

"They're hiding the Confederate battle flag within the stars and stripes."

Graham-Dixon likens this design to a rebel yell.

"It's as if to say, 'We may have been forcibly incorporated into the United States but we still feel southern,'" he says.

"It's very interesting that something as uniform as a flag could be adapted to express such different aspects of the American conflict."

Original star-spangled banner

As long as you had the right number of stars, you could configure it however you wanted Andrew Graham-Dixon

The most famous American flag of all is this huge banner from almost 200 years ago. And the most notable aspect of its design is its sheer size.

In 1813, with the US again at war with its former colonial ruler and an attack expected on Baltimore, the commanding officer of Fort McHenry requested "a flag so large that the British would have no difficulty seeing it from a distance".

As well as spook the enemy, he hoped it would also rally the spirits of Baltimore's citizens and soldiers alike.

It took Maryland flagmaker Mary Pickersgill, and her young assistants, weeks to sew short strips of wool bunting into the 42-foot (12.8m) flag that would become known as the star-spangled banner.

It is now on permanent display at the Smithsonian in Washington DC.

Modern art

Several decades after the flag's design was set in stone, artist Jasper Johns adopted it as a favourite subject. White Flag, from 1955, now hangs in New York's Metropolitan Museum of Art.

"By painting the flag he expressed how he felt about America," says Graham-Dixon. "He painted this in the McCarthyite period, and he was gay and left-wing."

Johns was never explicit about the message of his paintings, but Graham-Dixon likens the whited-out stars and stripes to the right-wing patriots' suspicion of America's diversity.

Under the paint is a collage of beeswax and scraps of newsprint, torn from headlines and articles, adverts and letters to the editor.

"It's a strange babble of voices. I think his idea was that all the many voices of America were being submerged beneath the idea of a single nation [represented by] the flag. It's the conflict between trying to make America a nation and allowing it to be millions of people all expressing their own differences."

Image caption The US flag is a familiar fixture

Johns used the flag because in the US, it is an everyday object, rather than one brought out for special occasions such as football matches or royal weddings as in the UK.

"If you go to Spain or England or Scotland, there may be an occasional flag, often tied to some idea of separatism. But in America it's everywhere," says Graham-Dixon.

"It is such a huge continent, so the flag becomes a point of coherence, a rallying point. And underneath its apparent uniformity, the flag has also been a focus for statements that don't quite toe the patriotic line."

Art of America starts on BBC Four on Monday 14 November at 2100GMT, or catch up with iPlayer.