Prepare the oven and pans: Preheat your oven to 350°F (175°C). Grease and flour two 9-inch round cake pans.
Mix dry ingredients: In a large bowl, combine flour, sugar, baking powder, baking soda, cinnamon, and salt.
Combine wet ingredients: In another bowl, whisk together eggs, oil, and vanilla extract until well combined.
Combine wet and dry ingredients: Add the wet ingredients to the dry ingredients and mix until just combined.
Add carrots and walnuts: Fold in the grated carrots and walnuts (if using).
Bake the cake: Pour the batter evenly into the prepared pans. Bake for 30-35 minutes, or until a toothpick inserted into the center comes out clean.
Cool the cakes: Let the cakes cool in the pans for 10 minutes before transferring to a cooling rack to cool completely.
Make the frosting: Beat the cream cheese and butter together until smooth. Gradually add the powdered sugar and vanilla extract, and continue to beat until the frosting is creamy and fluffy.
Frost the cake: Once the cakes are completely cool, spread a generous layer of frosting between the layers and on top of the cake.
Serve and enjoy: Slice and serve the cake. Enjoy!