All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
The word “fasting” means “to abstain”. In the Sharee’ah, fasting means a special abstention from special things during special times.
A Muslim should try his best and make sure that nothing reaches his stomach as the Prophet said: “And snuff water into your nostrils (during ablution) strongly, unless you are fasting.” [Abu Daawood, At-Tirmithi, Ibn Maajah and An-Nasaa’i] Therefore, exaggerating in snuffing the water, which means inhaling water though the nose, is desirable for a non-fasting person because some of it may get into his stomach, and it is for this reason that a fasting person is forbidden from doing so.
Therefore, it is better for a fasting person to avoid using toothpaste so that nothing of it reaches his stomach, especially that some pieces of some kinds of toothpaste fall into the throat especially when one does not make sure to avoid it.
However, if the fasting person has a real need to use it, while making sure that nothing of it gets into his stomach, then he could use it because of the need even if he finds its taste on his tongue, as a woman is permitted to taste the food while fasting if she needs to do so. But if there is no need to do so, it is disliked.
Allaah knows best.