Two 12-year-old boys have been charged with aggravated sexual assault and sexual intercourse with a child under 10, after allegedly raping a six-year-old girl at a North Sydney school.

"Detectives from the State Crime Command's Child Abuse Squad were alerted by the Department of Education following incidents at a school on Sydney's Northern Beaches," police said in a statement on Thursday.

"Following an extensive investigation, two boys, both aged 12, were arrested at Chatswood Police Station on Tuesday."

One boy was charged with four counts of aggravated sexual assault and two counts of sexual intercourse with a child under 10.

The other boy was charged with two counts of aggravated sexual assault and sexual intercourse with a child under 10.

They have both been granted bail, and will appear at a children's court later this month.

Parents and carers of students at the school are being notified.

The Child Abuse Squad is comprised of detectives who are specially trained to investigate crimes against children, including sexual assault, physical abuse and serious cases of neglect.

Newshub.