"I think there may be a perception in the community that bad teeth are inherited," said study co-author Associate Professor Jeff Craig, from the Murdoch Children's Research Institute.
"But this research is an important message because it means parents and children themselves can take control.
"We're not doomed by genetics in tooth decay."
Dr Craig said the research, published in Cell Host & Microbe, was the first large study to look at the "oral microbiome" — the bacteria that live in our mouths.
"It's a big step forward. Studies of the gut microbiome, when twin studies were applied to that, there were some big leaps forward made in our understanding of genes versus environment," he said.
"And similarly, ours is the first big study of the oral microbiome that has really started to split those factors."
Genetics of good and bad bacteria
Scientists already knew that Streptococcus bacteria that lived in the mouth were associated with tooth decay.
But what wasn't clear was the degree to which the presence and growth of these bacteria were influenced by either genetics or environmental factors, like how much sugar is in your diet.
To work this out, the researchers took mouth swabs from 205 sets of genetically identical twins and 280 non-identical twins aged between five and 11 years.
This enabled the researchers to pin down differences in the genetic make-up of the oral microbiome of children who were the same age and shared the same environment.
The researchers found that certain bacteria in the mouth were inherited — but these were not the same bacteria that caused tooth decay.
They also found that the inherited bacteria decreased over time, and the bacteria linked to environmental factors increased over time.
Bacteria associated with tooth decay was more commonly found in children who consumed more sugar, and those same children also had less "good bacteria" — the bacteria associated with fewer cavities.
"Sugary foods grow communities of bad bacteria that are likely to eat into the teeth," Dr Craig said.
"Sugar feeds the bacteria, and the acid the bacteria produces erodes the teeth."
Oral hygiene starts early
Dr Craig said the results confirmed the advice of the dental profession was best when it came to preventing tooth decay: avoid sugar where possible, especially if it's in the form of a sugary drink or lolly, which is often held in the mouth for longer periods of time.
And of course, it's vital to brush at least twice a day.
There's no time that's too early for parents to start thinking about their child's oral hygiene, Dr Craig said.
"One of the myths is that you don't worry about your child's oral health until the teeth come through."
He said bacteria start growing even before the teeth appear and what we feed our children, even when they're toothless, can influence their future oral health.
"Tooth decay is one of the most prevalent diseases in children, but it's tragic because it's preventable," Dr Craig said.
"It's good to have preventative oral health, even before teeth appear."