Stars often count something — states, provinces, islands or peoples — or stand for unity and aspiration. The crescent moon, usually paired with a star, is most associated with Islam (though it's older than the faith). The sun stands for life, energy and a new dawn. As always, the exact meaning depends on each country's own history.
Stars

Stars are the most versatile symbol in flag design, and very often they count something. The 50 stars on the flag of the United States stand for its 50 states (the 13 stripes are the original colonies), and a new star was added each time a state joined. China's five stars represent the Communist Party leading the people; the European Union's ring of twelve stars stands for unity and completeness rather than a number of members.
A single star — a "lone star" — tends to mean unity, independence or a guiding light, as on the flags of Vietnam, Somalia, Ghana, Chile, Liberia and Turkey. Stars can also represent the people, the light of freedom, or a nation's aspirations for the future. The number, arrangement and even the number of points can all carry meaning.
The Southern Cross — stars as a constellation

Sometimes the stars aren't a count but a picture of the night sky. The Southern Cross — a constellation visible only from the southern hemisphere — appears on the flags of Australia, New Zealand, Brazil, Samoa and Papua New Guinea, marking their place in the world. Brazil goes furthest of all: its flag shows the exact sky over Rio de Janeiro on a specific date in 1889, with each star standing for a state. (Despite the name, the Southern Cross is stars, not a religious cross — a common mix-up we cover in why flags have crosses.)
Crescents and moons

The crescent moon, almost always paired with a star, is one of the most recognisable flag symbols — and today it's most strongly associated with Islam. It appears on the flags of many Muslim-majority nations, including Turkey, Pakistan, Tunisia, Algeria, Malaysia, Azerbaijan, Mauritania, Libya, the Maldives and Comoros. Interestingly, the symbol is far older than the religion: the star and crescent was linked to the ancient city of Byzantium and later became the emblem of the Ottoman Empire, from which it spread to the many lands the Ottomans influenced. So while a crescent usually signals Islamic heritage today, it isn't an exclusively religious symbol.
The sun

The sun stands for life, energy, light and — very often — a new dawn for a nation, which is why it appears on so many flags adopted at independence. Japan's flag is a single red sun disc; its name, Nihon, means "origin of the sun". Argentina and Uruguay share the golden "Sun of May", complete with a human face, while the Philippines, Kazakhstan, Kyrgyzstan, Namibia, Taiwan and North Macedonia all fly radiant suns whose rays often carry their own meaning. There are so many that we've given them a guide of their own: flags with suns on them.
Star shapes and points

Even the shape of a star can be meaningful. The five-pointed star is by far the most common, but there are striking exceptions: Israel's flag carries the six-pointed Star of David, a symbol of Judaism; Nepal's flag pairs a stylised sun and moon rather than stars at all; and some flags use unusual star forms to stand out. The count of points, like the count of stars, is rarely accidental.
Symbols can have several layers
The key thing to remember is that these symbols often mean more than one thing at once. A single crescent can be religious, historical and political all together; a star can honour the people, mark a state, and express hope for the future in the same breath. And the same symbol shifts meaning across borders — a sun means the Land of the Rising Sun in Japan but an Inca legacy in Argentina. To be sure what any flag's stars or moon really stand for, look up that country's own story on our Flag Explorer.
Frequently asked questions
What do the stars on the American flag mean?
The 50 stars represent the 50 states; the 13 stripes represent the original colonies. A star was added each time a state joined.
What does the star and crescent mean on a flag?
It's most associated with Islam and appears on many Muslim-majority countries' flags, though the symbol predates Islam through Byzantium and the Ottoman Empire.
What is the Southern Cross on flags?
A constellation visible in the southern hemisphere, on the flags of Australia, New Zealand, Brazil, Samoa and Papua New Guinea. It's stars, not a religious cross.
Why does Japan's flag have a sun?
The red disc is the sun; Japan's name means "origin of the sun", hence the Land of the Rising Sun.
Do all crescent flags represent Islam?
Most modern ones relate to Islamic heritage, but the crescent is an ancient symbol used long before Islam, so it isn't exclusively religious.