If your teeth are not too yellow and the teeth have recently turned yellow then you can usually get rid of the yellow teeth overnight or at least the same day using some hydrogen peroxide and baking soda.
Mix some hydrogen peroxide with a bit of baking soda and then use the mixture to brush your teeth with.
The yellow stained teeth will usually come clean and turn back to white within a few minutes.
Sometimes it may take a few days of brushing your teeth with the baking soda and hydrogen peroxide to get rid of the yellow teeth depending on how yellow they are.
Teeth whitening strips also work to get rid of yellow teeth overnight as long as the teeth haven't been stained yellow too long.
In some cases you may need to see a dentist to get your teeth professionally whitened and remove the yellow tooth stains.
To prevent further yellow tooth stains make sure to brush your teeth around 2 to 3 times per day to prevent the stains from happening.