Indonesia’s move has been applauded by rights activists, who say non-Muslim girls were forced for years to wear the head-covering in conservative parts of the country.
Indonesia has banned schools from forcing girls to wear Islamic headscarves after the case of a Christian pupil pressured to cover up sparked outrage in the world's most populous Muslim nation.
The move was applauded on Friday by rights activists, who say non-Muslim girls have been forced for years to wear a hijab in conservative parts of the country.
State schools across the Southeast Asian archipelago of nearly 270 million will face sanctions if they fail to comply with the edict from Education Minister Nadiem Makarim.
On Wednesday he said religious attire was an individual choice, and said schools "cannot make it compulsory."
Schools that violate the rules could see their government funding cut, he added.
'Positive step to protect women's rights'
"The decree is a positive step to protect women's rights in Indonesia," said Andreas Harsono, senior researcher at Human Rights Watch in Jakarta.
He said public schools had forced millions of girls and women teachers to wear a hijab, prompting "bullying, intimidation, social pressures — and in some cases, expulsion and forced resignation" if they didn't.
There have been concerns about growing religious intolerance in a nation where nearly 90 percent of the population follows Islam.
The headscarf issue grabbed headlines after a Christian student in West Sumatra's Padang City was pressured to wear a hijab.
She refused, and her parents later secretly recorded a meeting with an official who insisted that school rules required all girls to wear a hijab, regardless of their religion.
The school later issued an apology after the video went viral.
Religious affairs minister, Yaqut Cholil Qoumas, described the Sumatra case as the "tip of the iceberg."
"Religion is not supposed to be a reason for conflict or a justification to act unfairly towards those with different beliefs," he said.
The new regulations will not apply to conservative Aceh province, which follows religious law under a longstanding autonomy deal.