Drain the pasta and then rinse in cold water to stop the cooking process.
Cool the pasta at room temperature for 10 minutes.
Grate the onion on a box grater so it is finely grated.
1/4 yellow onion
Grate the carrot on the coarsest hole of the box grater.
1/4 cup carrot
Place the pasta in a large mixing bowl and mix with the mayo, shredded onion, shredded carrot, sugar, and salt and pepper. Taste and add more seasoning if you want.
1 cup mayonnaise, 1 teaspoon granulated sugar, 1/2 teaspoon salt, 1/2 teaspoon ground black pepper
Mix to combine.
Place the bowl in the fridge to chill for 1 hour.
Notes
Store leftover macaroni salad in a lidded airtight container in the fridge for up to 4 days. Stir to remix the dressing before serving.