In a small saucepan, whisk flour into milk together over medium-low heat, stirring constantly, until it thickens. It will be the consistency of a thick paste2. Make sure that you whisk the flour and milk together well before you begin cooking it to avoid lumps.
Remove from heat and let it cool to room temperature. This step is key. If your mixture is warm, it will melt your butter, and you'll end up with runny frosting.
Stir in vanilla.
While the mixture is cooling, cream the butter, sugar, and salt together until light and fluffy on medium high-high3, about 5 minutes4. Make sure that you scrape down the sides and really incorporate the butter and sugar to avoid gritty frosting.
Then add the completely cooled milk mixture.
Beat it for about 5 more minutes on medium-high to high until it looks like whipped cream. It may look separated at first, so keep beating it until it comes together and looks like a whipped cream.
Make sure that your butter isn't too warm! The butter should be at cool room temperature. You want it to dent if you press it, but you don't want it to be so warm that it's near melting.
When cooking the milk/flour mixture, you don't want it to look wet. It should be like a thick paste. If it's wet and runny, your frosting will be too loose.
If you're using a hand mixer, beat it on high. This recipe work well with a stand mixer because it has the power to really whip the frosting.
Please don't cut the mixing time short! I know it's tempting, but it's important to beat the butter and sugar together for the time the recipe calls for to keep it from being gritty. If you cut the mixing times short, you won't end up with the right texture of frosting.
To get the best flavor, you'll want to use real butter and pure vanilla extract.
Want to try a buttercream made with powdered sugar instead? Here is my favorite vanilla buttercream frosting that's made with powdered sugar.
I recommend chilling any leftover frosted cake or cupcakes.