Carrot cake from scratch is an incredibly moist, warmly spiced layer cake made with freshly grated carrots, oil, eggs, and aromatic spices like cinnamon and nutmeg, topped with a tangy cream cheese frosting. The carrots add moisture and natural sweetness — not a “vegetable taste” — making this one of the most reliably tender cakes you can bake. This recipe yields two 9-inch layers and serves 12 to 16 people.
Why Carrot Cake From Scratch Beats Any Box Mix
Carrot cake is one of those recipes where making it from scratch is genuinely worth the extra effort. Boxed versions can’t replicate the fresh, moist texture you get from real carrots grated right before mixing, and they typically use artificial flavors that fall flat compared to the real thing. A scratch carrot cake using oil (not butter) stays moist for days, develops deeper spice flavor overnight, and has a crumb that’s consistently tender even when cold.
It’s also surprisingly forgiving. Unlike delicate white cakes that require precise creaming and temperature control, carrot cake batter comes together with a whisk and a bowl. There’s no creaming, no separating eggs — you just mix wet into dry, fold in the carrots, and bake.

Ingredients
Here’s everything you need for the cake and the cream cheese frosting:
For the Carrot Cake
- 2 cups (240g) all-purpose flour
- 2 tsp baking soda
- 1½ tsp ground cinnamon
- ½ tsp ground nutmeg
- ¼ tsp ground ginger
- ¼ tsp ground cloves (optional but recommended)
- ½ tsp fine sea salt
- 1½ cups (300g) granulated sugar
- ½ cup (100g) packed light brown sugar
- 1 cup (240ml) vegetable oil (or any neutral oil)
- 4 large eggs, room temperature
- 2 tsp pure vanilla extract
- 3 cups (300g) finely grated fresh carrots (about 4–5 medium carrots)
- 1 cup (115g) chopped walnuts or pecans (optional)
- ½ cup (120g) crushed pineapple, well drained (optional, adds incredible moisture)
For the Cream Cheese Frosting
- 16 oz (450g) full-fat block cream cheese, room temperature
- ½ cup (115g) unsalted butter, room temperature
- 4–5 cups (480–600g) powdered sugar, sifted
- 2 tsp pure vanilla extract
- Pinch of salt
A Note on the Oil vs. Butter Debate
Carrot cake is traditionally made with oil, not butter, and for good reason. Oil coats the gluten strands differently than butter, resulting in a cake that stays tender and moist even after refrigerating. Butter solidifies when cold, making a butter-based cake feel denser when served chilled. Since carrot cake is often served cold (to keep the cream cheese frosting firm), oil is the correct choice here. According to Serious Eats’ extensive carrot cake testing, oil-based carrot cakes consistently outperform butter-based ones in moisture retention and texture.

How to Prepare the Carrots
Carrot prep is the most important step in this recipe. Always use freshly grated carrots — never pre-shredded bags from the grocery store. Pre-shredded carrots are too dry and too coarse; they don’t soften properly during baking and can create a stringy, uneven texture. Freshly grated carrots contain moisture that steams the cake from within as it bakes, contributing directly to that signature moistness.
Use the fine holes of a box grater or the fine shredding disc on a food processor. You want thin, feathery shreds that will essentially melt into the batter. Grate them right before you need them — don’t let them sit and dry out. You need about 3 cups, which is roughly 4 to 5 medium-sized carrots. Peel them first, then grate directly into your mixing bowl.
Step-by-Step Instructions
Step 1: Preheat and Prep Pans
Preheat oven to 350°F (175°C). Grease two 9-inch round cake pans, line the bottoms with parchment paper, then grease and flour again. This multi-layer prep guarantees clean release. Alternatively, use 9×13-inch pan for a sheet cake format — instructions for that variation are in the FAQ below.
Step 2: Mix the Dry Ingredients
In a large bowl, whisk together the flour, baking soda, cinnamon, nutmeg, ginger, cloves, and salt. Whisk thoroughly — you’re both combining and aerating the dry mix. Set aside.
Step 3: Whisk the Wet Ingredients
In a separate large bowl, whisk together both sugars and the oil until combined. Add the eggs one at a time, whisking after each addition. The mixture should look smooth and glossy. Add the vanilla extract and whisk to combine. If using crushed pineapple, stir it in now — it adds invisible moisture and a subtle tropical sweetness that doesn’t read as “pineapple” in the final cake, it just makes everything taste richer.

Step 4: Combine Wet and Dry
Pour the wet ingredients into the dry ingredients and fold together with a rubber spatula until just combined. Stop the moment you no longer see dry streaks of flour. Overmixing at this stage develops gluten and makes the cake tough — you want a lumpy, slightly thick batter, not a perfectly smooth one.
Step 5: Fold in Carrots and Nuts
Add the grated carrots and the chopped walnuts or pecans (if using). Fold in gently with the spatula — about 8 to 10 folds — until evenly distributed. The batter will look chunky and thick, which is correct. The carrots will release moisture as the cake bakes, creating those characteristic moist pockets throughout the crumb.
Step 6: Bake
Divide the batter evenly between the prepared pans. A kitchen scale is useful here — aim for equal weights so the layers bake uniformly. Smooth the tops with an offset spatula. Bake at 350°F for 30–35 minutes. The cake is done when a toothpick inserted in the center comes out clean or with a few moist crumbs, and the edges are pulling away from the sides of the pan. Do not overbake — carrot cake dries out quickly once past the ideal doneness point.

Step 7: Cool Completely
Cool the cakes in their pans on wire racks for 15 minutes. Then run a thin offset spatula around the edges and invert onto the racks. Peel away the parchment and let cool completely — at least 1 to 2 hours. Cream cheese frosting melts almost immediately on a warm cake, so patience here is essential. If you’re in a hurry, the layers can go in the fridge or freezer to speed up cooling.
How to Make the Cream Cheese Frosting
In a large bowl using a hand mixer or stand mixer, beat the room-temperature cream cheese on medium speed for 1–2 minutes until smooth and lump-free. Add the room-temperature butter and beat until fully combined and fluffy. Add the vanilla and salt, then add the powdered sugar one cup at a time on low speed. Once incorporated, increase to medium-high and beat for 1–2 minutes until light and fluffy.
The frosting should be thick enough to hold a shape but spreadable. If it’s too soft (this happens when cream cheese is too warm), refrigerate for 20 minutes and beat again. The key for any cream cheese frosting is using full-fat block cream cheese — not whipped, not spread, not low-fat. Those versions have too much moisture and will never set properly. For more detail on getting cream cheese texture right, see our vanilla cheesecake recipe which uses the same cream cheese technique.

Assembling the Carrot Cake
Place one cooled cake layer on a cake board or serving plate. If the layers domed during baking, use a long serrated knife to level the top — a flat surface makes frosting far easier and the assembled cake looks more professional. Spread about 1 to 1½ cups of frosting evenly over the top. Place the second layer on top (flat-side up) and press gently. Apply a thin crumb coat — a thin scrape of frosting all over the outside — and refrigerate for 30 minutes to set. This step locks in any loose crumbs so your final frosting coat goes on clean.
Apply the final frosting layer and use a bench scraper or offset spatula to smooth the sides. For a rustic look, use the back of a spoon to create swooping peaks all over the surface. Garnish with whole toasted walnuts or pecans on top, and optionally a few small marzipan carrots for the classic bakery presentation. The finished cake benefits from at least 1 hour in the fridge before slicing — it sets the frosting and allows the spices to deepen.

Tips for the Best Carrot Cake
- Grate your own carrots. Pre-shredded bags are too dry and coarse. Fresh, finely grated carrots are the single biggest factor in texture and moisture.
- Add crushed pineapple. It sounds unusual but it’s one of the oldest carrot cake secrets — a half cup of well-drained crushed pineapple adds undetectable moisture and depth. You won’t taste pineapple, just an extra-juicy crumb.
- Toast your nuts first. Toasting walnuts or pecans in a dry skillet for 3–4 minutes before chopping amplifies their flavor dramatically. Untoasted nuts can taste flat against the bold spice profile of the cake.
- Don’t skip the spices. A good carrot cake should taste warmly of cinnamon and nutmeg with hints of ginger and clove. Under-spiced carrot cake is just sweet and one-dimensional.
- Room temperature cream cheese is non-negotiable. Cold cream cheese creates lumpy frosting that won’t smooth out no matter how long you beat it. Give it at least 1 hour at room temperature.
- Chill before slicing. Carrot cake slices more cleanly when the frosting has set in the fridge for at least an hour. Warm cream cheese frosting smears.
Variations
Once you’ve mastered the base recipe, here are some popular variations worth trying:
- Carrot Cake Cupcakes: Use the same batter divided into lined muffin tins. Bake at 350°F for 18–20 minutes. Pipe cream cheese frosting on top with a star tip.
- Spiced Carrot Sheet Cake: Pour into a greased 9×13-inch pan and bake for 35–40 minutes. Sheet cake is easier to transport and serves more people — great for parties and potlucks.
- Carrot Cake with Raisins: Fold ½ cup of golden raisins into the batter along with the carrots. They plump during baking and add little bursts of sweetness. Soak them in warm water for 10 minutes first for extra plumpness.
- Tropical Carrot Cake: Add shredded coconut and crushed macadamia nuts along with the pineapple for a tropical spin that pairs beautifully with a coconut cream cheese frosting.
- Carrot Cake Cheesecake: Use the carrot cake as a crust base and top with a classic cheesecake layer — a mashup that’s become popular in bakeries. Check out our lemon cheesecake for cheesecake layer technique.
Storage
Because of the cream cheese frosting, carrot cake must be refrigerated after the first day. Keep it covered in the fridge for up to 5 days. Unlike most butter-frosted cakes, carrot cake actually improves after a night in the fridge — the spices bloom and the crumb tightens into an even more satisfying texture. Let slices come to room temperature for 15–20 minutes before eating for the best flavor and texture.
Unfrosted cake layers can be wrapped tightly in plastic and frozen for up to 3 months. Thaw overnight in the fridge before frosting and assembling. Fully frosted carrot cake can also be frozen — freeze uncovered until the frosting sets solid (about 2 hours), then wrap tightly in plastic and foil. Thaw overnight in the fridge. For other make-ahead cake storage tips, see our guide on funfetti cake from scratch which covers the same freezing method.
What to Serve With Carrot Cake
Carrot cake is one of those desserts that stands well on its own, but a scoop of vanilla ice cream alongside a chilled slice is a classic pairing. Hot coffee or chai tea cut through the richness of the cream cheese frosting beautifully. For a full dessert spread, carrot cake pairs naturally with spring and Easter themes — our easy flan recipe makes another elegant, make-ahead dessert for the same occasion. For a dessert table that leans into the sweet-and-indulgent theme, our strawberry cheesecake and homemade churros complete the spread perfectly.
Frequently Asked Questions
Can I make this as a sheet cake instead of layers?
Yes. Pour all the batter into a greased and lined 9×13-inch baking pan and bake at 350°F for 38–44 minutes, or until a toothpick comes out clean. Sheet cake is easier to frost and transport and is perfect for large gatherings. Halve the frosting recipe if you prefer a lighter coating on a sheet cake.
Why is my carrot cake dense?
Dense carrot cake is usually caused by too much flour (measure by weight, not volume), overmixing the batter after adding the flour, or baking at too low a temperature. Make sure your baking soda is fresh — old baking soda loses its lift. See our full breakdown in the why is my cake dense guide for a complete troubleshooting list.
Can I use baby carrots instead of regular carrots?
Baby carrots work in a pinch but they tend to be drier and less flavorful than full-sized carrots. If you use them, increase the quantity slightly (about 10–15% more) to account for the lower moisture content. Full-sized fresh carrots are always the better choice for carrot cake.
My cream cheese frosting is runny — how do I fix it?
Runny frosting is almost always caused by cream cheese that’s too warm or too soft. Refrigerate the whole bowl of frosting for 20–30 minutes, then re-beat. If it’s still too soft, add more sifted powdered sugar 1/4 cup at a time until the right consistency is reached. Avoid over-beating cream cheese frosting — over-mixing after the cream cheese is at room temperature can also make it loose.
Does carrot cake need to be refrigerated?
Yes — because of the cream cheese frosting, carrot cake must be refrigerated after the first day. An unfrosted carrot cake can sit at room temperature under a dome for up to 2 days, but once frosted, it needs to be kept cold. Store covered in the refrigerator for up to 5 days and let slices come to room temperature before serving.
