Preheat the oven to 350°F (175°C) and grease and flour a 9x13-inch baking pan.
In a large bowl, whisk together flour, sugar, baking powder, baking soda, salt, cinnamon, and nutmeg.
In another bowl, mix together eggs, oil, and vanilla extract until smooth.
Gradually add the dry ingredients to the wet mixture, stirring until just combined.
Fold in the grated carrots and walnuts (if using).
Pour the batter into the prepared pan and bake for 40-45 minutes or until a toothpick inserted into the center comes out clean.
Allow the cake to cool in the pan for 10 minutes, then transfer to a wire rack to cool completely.
Once cooled, frost with cream cheese frosting or your preferred frosting.
Slice and serve.