Whether you like your carrot cake plain or with all the mix-ins, this recipe has you covered. Serve this sweetly spiced dessert with walnuts, raisins, coconut, and pineapple—or keep it simple with only shredded carrots in the batter. Either way, it's a guaranteed treat, especially when each slice gets a luxurious layer of cream cheese frosting.
Make the cake:
Preheat the oven to 350 degrees F. Spritz the bottom and sides of 2 8-inch round or square baking pans with nonstick baking spray or grease with butter. Line the bottom of each pan with parchment paper.
Whisk the flour, baking powder, baking soda, cinnamon, allspice, and salt together in a medium bowl. Set aside.
Beat the eggs and both sugars together in a large bowl with an electric hand mixer or with a stand mixer fitted with the paddle attachment on medium speed for about 2 minutes, until any large clumps of brown sugar have dissolved and the eggs have thickened and lightened in color.
Reduce the mixer speed to low and pour in the oil, stirring until incorporated.
On low speed, stir in half the flour mixture, then the pineapple or applesauce, then the remaining flour mixture.
Stir in the carrots and any other add-ins—walnuts, coconut, and/or raisins.
Divide the batter evenly between the two prepared pans. Bake for 30-35 minutes, until a cake tester or knife inserted into the center of each cake comes out clean.
Transfer the pans to wire racks and cool the cakes completely in the pans. Slide a butter knife around the edges of each cooled cake before removing from the pan and peel the parchment paper off the bottom of each cake before frosting.
Make the frosting and assemble:
Beat the cream cheese and butter together in a large bowl with an electric hand mixer or with a stand mixer fitted with the paddle attachment on medium speed until the butter has been completely blended with the cream cheese.
Add the sugar a few spoonfuls at a time, beating until the sugar is completely incorporated and the frosting is pale and thick. Add the vanilla or lemon extract and beat for 30 seconds more.
Line a serving plate with 3 strips of waxed paper, layering them so they cover the edges of the plate but leave a triangle of uncovered plate in the center.
Place one cake layer in the center of the serving plate. Spread about 1/4 of the frosting across the top. Place the remaining cake layer on top and cover the top and sides of the cake with the remaining frosting.
Sprinkle the top of the cake with coconut, if desired.
Carefully remove the strips of waxed paper, pulling them out from under the frosted cake to leave a clean serving plate.
Make-ahead: Cakes can be made 1 day before frosting. Remove the cooled cakes from the pans, peel off the parchment paper, and wrap tightly in plastic wrap. Store at room temperature or in the refrigerator until ready to frost.
Once frosted, leftover cake can be stored in the refrigerator for up to 3 days.