Bring a large pot of salted water to a boil. Add the elbow macaroni and cook according to package instructions until al dente. Drain and set aside.
In a medium saucepan, melt the butter over medium heat. Once melted, add the flour and whisk together to form a roux. Cook for about 1-2 minutes until the mixture is slightly golden.
Gradually whisk in the milk, ensuring there are no lumps. Continue whisking until the mixture thickens and bubbles gently, about 5 minutes.
Reduce the heat to low, then add the shredded cheddar cheese, garlic powder, onion powder, salt, and black pepper. Stir until the cheese is fully melted and the sauce is smooth.
Combine the cooked macaroni with the cheese sauce in the large pot. Stir well to ensure all the pasta is coated.
Serve immediately, or pour the macaroni and cheese into a baking dish and sprinkle with additional cheese or breadcrumbs if desired. Bake in a preheated oven at 350°F (175°C) for about 10 minutes, until the top is bubbly and golden.