Praise be to Allah.
The Muslim who intends to fast should clean his teeth at night and remove any bits of food that may be stuck to them or caught in between them. He should also rinse his mouth out well when he does wudoo’, to remove any bits of food that may be stuck to his teeth.
If a person voluntarily swallows bits of food that are caught between his teeth when he is able to spit them out, then he invalidates his fast by doing that. But if he swallows them without meaning to, such as if they go into his throat with his saliva and he cannot stop that, then his fast is valid and he does not have to do anything else.
Al-Nawawi (may Allaah have mercy on him) said: Our companions – i.e., the Shaafa’is – said: If there is some food left between his teeth, then he should remove it at night and clean his mouth. If he starts his day fasting and there is anything stuck between his teeth and he swallows it deliberately, then his fast is invalidated and there is no difference of opinion among us concerning that. This was also the view of Maalik, Abu Yoosuf and Ahmad.
Our evidence for ruling that his fast is invalidated is that he swallowed it when he was able to spit it out, and there was no need to do that, so he has invalidated his fast, just as if he had spat it out into his hand and then swallowed it.
But if it mixes with his saliva and he swallows it without meaning to, then there is a difference of opinion narrated by our companions from al-Shaafa’i. Some of them narrated that it breaks the fast, and some of them narrated that it does not break the fast. The correct view is that of the majority, which is that there were two situations in this case. When he said that it does not break the fast, he was referring to a situation where it cannot be distinguished and spat out. And when he said that it does break the fast, he was referring to a situation where the person was able to spit it out but did not do so, and swallowed it instead. End quote.
See also the answer to question no. 78438 for a useful quotation from Ibn Qudaamah, and the answer to question no. 22981 for useful guidelines on things that invalidate the fast.
And Allaah knows best.