Instructions:
Preheat oven to 350°F (180°C) and grease a 9×13-inch baking pan.
In a medium bowl, whisk together the flour, baking powder, baking soda, cinnamon, and salt.
In a separate large bowl, mix together the grated carrots, vegetable oil, eggs, sugar, and vanilla extract until well combined.
Add the dry ingredients to the wet ingredients and mix until just combined. Fold in the chopped walnuts (if using).
Pour the batter into the prepared baking pan and bake for 35 to 40 minutes, or until a toothpick inserted into the center comes out clean.
While the cake is baking, prepare the cream cheese frosting. In a large bowl, beat the cream cheese and butter until smooth. Gradually add the powdered sugar and vanilla extract, beating until the frosting is smooth and creamy.
Once the cake has cooled completely, spread the frosting evenly over the top of the cake.
Slice, serve, and enjoy your delicious homemade carrot cake!