Start by melting butter in a saucepan over medium heat. Once the butter is completely melted, whisk in the all-purpose flour and cook for 1 minute, stirring constantly to prevent burning. This creates your roux, which will thicken the sauce.
Slowly pour in the milk while whisking continuously to prevent lumps from forming. Continue cooking over medium heat for 3-5 minutes, stirring constantly, until the white sauce thickens and starts to bubble.
Remove the saucepan from heat and add the grated cheddar cheese. Stir until the cheese is completely melted and the sauce is smooth. Season with salt and pepper to taste, then serve immediately while hot.
Notes
Keep the heat at medium or medium-low - Too high heat can cause the sauce to burn on the bottom or thicken too quickly, leading to a grainy texture.
Grate your own cheese - Pre-shredded cheese contains additives that can prevent smooth melting. Fresh grated cheese melts much better.
Add milk slowly - Pouring the milk in gradually while whisking prevents lumps and ensures a smooth sauce.
Stir constantly - This prevents the sauce from sticking to the bottom of the pan and burning.