If we were neighbors, this is the cake I would show up with when you text I need dessert in an hour please. It is my Coconut Cake with Pineapple Filling Recipe and it has saved more birthdays and Tuesday slumps than I can count. The first time I baked it, my aunt said it tasted like a sunny vacation without the airport socks situation, which was oddly specific but fair. Also, full disclosure, I once ate a slice for breakfast after a morning walk and did not regret it even a smidge.
Why you might fall for this cake like I did
I make this when the weather is meh and I want something bright. My family goes a little bonkers for the pineapple layer because it is juicy in the best way and balances the sweet coconut crumb. It is the cake I take to potlucks when I want to bring something cheerful but not fussy. The batter comes together fast, and the filling is basically a quick stovetop jam. The only tricky bit is waiting for things to cool, which I used to rush and then wondered why the layers slid around. Learned that lesson the sticky way.
(If you are coconut shy, I get it. Actually, I find it works better if you toast the coconut for topping, it gets nutty and less sweet.)
Ingredients you will need, with a few honest swaps
For the coconut cake
- 2 and 3/4 cups cake flour 330 g, spooned and leveled. I sometimes use all purpose flour 330 g plus 2 tbsp cornstarch if I am out of cake flour. If you are curious, this quick guide is helpful: cake flour basics.
- 1 tbsp baking powder
- 1 tsp fine sea salt
- 1 and 3/4 cups granulated sugar 350 g
- 3 large eggs at room temp
- 2 large egg whites, room temp. I keep the yolks for custard sometimes.
- 3 tbsp neutral oil
- 1 stick unsalted butter 113 g, softened
- 1 cup coconut milk full fat, well shaken. In a pinch, I use 3 fourths cup milk plus a splash of cream and a spoonful of shredded coconut.
- 1 tsp vanilla extract and 1 tsp coconut extract optional but nice
- A handful 40 g sweetened shredded coconut for the batter if you like a little chew
For the pineapple filling
- 1 can 20 oz 567 g crushed pineapple in juice, undrained. My grandmother swore by a certain brand, but honestly any good one is fine. I often grab Dole and it works: crushed pineapple.
- 1 third to 1 half cup sugar 65 to 100 g depending on sweetness of the fruit
- 2 tbsp cornstarch
- 1 tbsp lemon juice plus a pinch of salt
For the frosting
- 8 oz 226 g cream cheese, softened
- 1 stick 113 g unsalted butter, softened
- 3 to 3 and 1 half cups powdered sugar 360 to 420 g, to taste
- 1 tsp vanilla extract, tiny splash coconut extract optional
- 2 to 3 tbsp coconut milk as needed for consistency
- 2 cups toasted shredded coconut for the outside. Or leave it untoasted if that is your vibe.
Sub notes
- No coconut extract. Skip it, the cake is still properly coconutty.
- If you are short on butter, use all oil in the batter 120 ml and reduce coconut milk by a splash. Texture gets a tad softer.
- Gluten free. A good 1 to 1 baking blend works here, though the crumb is a touch more tender. I tend to think it is lovely.
Let us bake it, step by step but not too fussy
- Heat the oven to 350 F 175 C. Grease and line two 8 inch or 9 inch round pans with parchment. I trace the pans with a pencil, cut the circles, done.
- Whisk flour, baking powder, and salt in a bowl. Set aside.
- In a large bowl, beat the butter and sugar for 2 to 3 minutes until pale and a bit fluffy. Add oil and beat another 30 seconds. This is where I usually sneak a taste, purely scientific.
- Beat in eggs and egg whites one at a time. Do not panic if it looks slightly curdled, the flour fixes it.
- Stir vanilla and coconut extract into the coconut milk. Add the dry ingredients to the wet in three additions, alternating with the coconut milk mixture, starting and ending with dry. Mix just until combined. Fold in shredded coconut if using. Batter should look smooth and a little thick but pourable.
- Divide batter between pans. Tap each pan firmly on the counter to pop big bubbles. Bake 25 to 30 minutes for 8 inch, 22 to 27 for 9 inch, until the centers spring back and a skewer comes out with a crumb or two.
- Cool in pans 10 minutes, then turn out to a rack. Let it cool in it’s pan fully if you are nervous about breaking layers. On second thought, fully cool on a rack if you want crisp edges for stacking.
Make the pineapple filling
- In a saucepan, whisk sugar and cornstarch. Add crushed pineapple and all its juice, plus lemon and salt. I do not drain it, because the cornstarch needs the liquid to thicken.
- Cook over medium, stirring, until bubbly and thick, 5 to 8 minutes. It will go from soupy to glossy jam rather quickly, so stay close. If it looks a bit weird at this stage it always does.
- Cool to room temp. You can chill it 20 minutes if you are in a hurry. And yes, this is spoon snackable, be warned.
Make the frosting
- Beat cream cheese and butter until completely smooth. Sift in powdered sugar in two additions. Add vanilla and enough coconut milk to get a spreadable but sturdy frosting.
Assemble
- Level your cakes if needed. Place first layer on a plate. Pipe or spoon a ring of frosting around the edge as a dam. Fill the center with pineapple filling, about a generous half inch thick.
- Top with second layer. Crumb coat the whole cake thinly. Chill 15 to 20 minutes. Finish with the remaining frosting. Pat toasted coconut around the sides like snow, but warmer.
Tiny digression. I once tried using a pineapple corer on a fresh pineapple for this, then I remembered the canned crushed is perfect and the fresh version needs more cooking and sugar. Save the fresh for snacking, mate.
Notes from my messy notebook
- Room temp eggs really do whip better. If you forget, set them in warm water for 10 minutes. Here is a quick explainer that helped me stop guessing: how to whip egg whites.
- If the filling firms up too much in the fridge, stir in a teaspoon of hot water to loosen.
- Bake the cakes the night before, wrap well, and frost the next day. The flavor settles in and I think it tastes better the next day, just saying.
- I once over toasted the coconut until it was, um, tan plus. Still edible, but keep an eye, it goes from golden to oops fast.
Fun variations I tried
- Lime zest party. Add zest of one lime to the batter and another to the frosting. So bright.
- Pina colada vibe. Brush the cake layers with a tablespoon or two of pineapple juice or a splash of rum. Not boozy, just fragrant.
- Almond cousin. Swap vanilla for almond extract and skip the coconut in the batter. It is different, but lovely.
- The one that did not work. I folded fresh diced pineapple into the batter once. It sank and made gummy pockets. Tasty but not cute. I will not do that again.
Gear I used, and what to do if you do not have it
- Two round cake pans. If you only have one, bake in batches. Or use a 9 by 13 inch pan and just slather frosting on top, the filling can go in a thick middle stripe, still lush.
- Stand mixer or hand mixer. You can whisk by hand if you are feeling heroic, but your arms will notice.
- Offset spatula helps. A butter knife works in a pinch. I have used the back of a spoon and it was fine.
- Parchment. If you are out, butter and flour the pans well and run a thin knife around the edge before turning out.
How I store this cake
Keep it covered in the fridge, up to 4 days. The crumb stays soft thanks to the coconut milk. Bring slices to room temp before serving for best texture. It also freezes well in slices, double wrapped, for about a month. Though honestly, in my house it never lasts more than a day.
How we like to serve it
Cold slice, warm coffee. Or with a little dollop of softly whipped cream and a few extra pineapple tidbits around the plate. On birthdays we stick a sparkler on top and sing, loudly, off key, because tradition is half the flavor.
Lessons I learned the hard way
- I once tried rushing the cooling step and regretted it because the warm frosting slid like a sled. Chill for 15 minutes between coats, easy win.
- Another time I eyeballed the cornstarch and the filling was soupy. Measure, even if you feel brave.
- If your batter tunnels or bakes with large holes, you probably over mixed. Fold gently once flour goes in, it matters.
Questions you might ask
Can I make the cake ahead
Yes. Bake the layers a day ahead, wrap well, and assemble the next day. You can also make the filling two days ahead. Frosting is best the day of, but it holds overnight too.
Do I have to use cake flour
Nope. All purpose with a little cornstarch works. If you like a slightly tighter crumb, go straight all purpose, it will still be tasty.
Can I use fresh pineapple
You can, but cook it longer with extra sugar since fresh pineapple can be more tart and watery. Canned crushed gives consistent results, which I like when I am not in experiment mode.
Is the frosting too sweet
Not if you taste as you go. Start with less powdered sugar and add until it spreads nicely. A pinch of salt helps. And a squeeze of lemon is lovely if you want more tang.
What if I only have a 9 by 13 pan
Go for it. Bake 30 to 35 minutes. Cool, spread a layer of pineapple filling over the top, then frost. Different look, same sunshine flavor.
How do I toast the coconut without burning it
Oven at 325 F, spread coconut on a sheet, stir every 3 to 4 minutes, 8 to 12 minutes total. Or toast in a dry skillet, medium heat, stir constantly. Take it off just before it is as dark as you want. It will keep cooking a bit off the heat.
One last thing. When you open the pineapple can, drain it well, right form the can into the pot so you catch every drop of juice for the thickening magic. It is a small move that keeps the filling jammy rather than wet. Also, if you wander off to water your plants while the cakes cool, set a timer. Ask me how I know.
Ingredients
- 2 1/2 cups (312 g) all-purpose flour
- 2 1/2 teaspoons baking powder
- 1/2 teaspoon salt
- 1 cup (226 g) unsalted butter, room temperature
- 1 3/4 cups (350 g) granulated sugar
- 4 large eggs, room temperature
- 1 teaspoon vanilla extract
- 1 cup (240 ml) canned coconut milk, shaken
- 1 cup (100 g) sweetened shredded coconut, plus extra for garnish
- 1 (20 oz / 567 g) can crushed pineapple, drained (reserve juice)
- 1/3 cup (67 g) granulated sugar (for filling)
- 2 tablespoons cornstarch (for filling)
- 1 tablespoon lemon juice (for filling)
- 1 cup (240 g) unsalted butter, room temperature (for buttercream)
- 4 cups (480 g) confectioners’ sugar (for buttercream)
- 1/2 teaspoon coconut extract (optional, for buttercream)
Instructions
-
1Preheat oven to 350°F (175°C). Grease and flour two 9-inch round cake pans and line the bottoms with parchment paper.
-
2Whisk together flour, baking powder, and salt in a medium bowl and set aside.
-
3In a large bowl, cream 1 cup butter and 1 3/4 cups sugar until light and fluffy. Add eggs one at a time, mixing after each, then stir in vanilla. Alternate adding the dry ingredients and 1 cup coconut milk in three additions, beginning and ending with the dry ingredients. Fold in 1 cup shredded coconut.
-
4Divide batter evenly between prepared pans and smooth the tops. Bake for 25–30 minutes or until a toothpick inserted into the centers comes out clean. Cool in pans 10 minutes, then turn out to a wire rack to cool completely.
-
5While cakes bake, make the pineapple filling: combine drained crushed pineapple, 1/3 cup sugar, cornstarch, and lemon juice in a small saucepan. Cook over medium heat, stirring, until mixture thickens and becomes translucent, about 5–7 minutes. Remove from heat and cool to room temperature.
-
6Make the coconut buttercream: beat 1 cup butter until creamy, then gradually add confectioners’ sugar. Add a splash of reserved coconut milk or pineapple juice if needed to reach spreading consistency. Stir in coconut extract if using.
-
7Assemble the cake: level cake layers if needed. Place one layer on a serving plate, spread the cooled pineapple filling over the top (leave a 1/4-inch border), then top with the second cake layer. Frost the top and sides with coconut buttercream and press additional shredded coconut onto the sides and top. Chill briefly to set before serving.
Approximate Information for One Serving
Nutrition Disclaimers
Number of total servings shown is approximate. Actual number of servings will depend on your preferred portion sizes.
Nutritional values shown are general guidelines and reflect information for 1 serving using the ingredients listed, not including any optional ingredients. Actual macros may vary slightly depending on specific brands and types of ingredients used.
To determine the weight of one serving, prepare the recipe as instructed. Weigh the finished recipe, then divide the weight of the finished recipe (not including the weight of the container the food is in) by the desired number of servings. Result will be the weight of one serving.
Did you make this recipe?
Please consider Pinning it!!




