If you came over right now, I would push a plate at you before you could hang up your jacket and say, please try this Coconut Cake with Pineapple Filling, because it tastes like a beach party snuck into a bakery. The first time I baked it, my neighbor popped in to return a measuring cup and left with two slices, then texted me a crumb covered thank you which is the only kind that matters.
Also, brief detour. You know that one song that gets stuck in your head while you frost a cake and then your swirls accidentally match the beat. That was me with this cake, the frosting looked like a tiny ocean. Anyway, back to the cake.
Why you might fall for this, like I did
I make this when the weather pretends to be sunny or when we need something bright at the end of a long week. My family goes a bit bonkers for the pineapple layer because it tastes like vacation without the airport lines. And the coconut crumb on the outside, it whispers rather than shouts. I used to over sweeten it, but actually, I find it works better if the frosting leans creamy and the filling does the zippy work.
If you’ve ever wrestled with cake layers sliding around, same. I fixed that with a quick chill between steps and a little frosting wall around the filling. Sounds fussy, isn’t. Also, if your batter looks a touch curdled after adding the egg whites, do not panic, I promise it bakes up just fine.
What you’ll need, with my casual swaps
For the cake layers
- 2 and ½ cups cake flour, about 300 g. No cake flour. I sometimes use a mix of all purpose with a spoonful of cornstarch. If you want the science, I like this King Arthur Baking explanation.
- 2 and ½ teaspoons baking powder
- ½ teaspoon fine salt
- ¾ cup unsalted butter, 170 g, room temp
- 1 and ¾ cups granulated sugar, about 350 g
- 5 large egg whites, room temp if you remember
- 1 cup full fat coconut milk, well shaken
- ¼ cup sour cream or thick yogurt when I’m out
- 2 teaspoons vanilla extract
- ½ teaspoon coconut extract, optional but fun
- 1 cup lightly toasted shredded coconut, sweetened or unsweetened, totally optional
For the pineapple filling
- 1 can crushed pineapple in juice, 20 oz, do not drain
- ⅓ cup sugar, bump to ½ cup if you like it sweeter
- 2 and ½ tablespoons cornstarch
- 1 tablespoon lemon juice, fresh if you can
- Pinch of salt
- 1 tablespoon butter, optional for gloss
For the frosting and finish
- 16 oz cream cheese, room temp
- ½ cup unsalted butter, 115 g, room temp
- 4 cups powdered sugar, about 480 g
- 2 to 3 tablespoons coconut milk or regular milk, as needed
- 1 teaspoon vanilla, ½ teaspoon coconut extract if you like
- 1 to 2 cups shredded coconut for the outside, a couple of good handfuls
My grandmother always insisted on a certain brand of coconut flakes, but honestly any version works fine. I’ve used bargain shelf stuff and it was grand.
Let’s bake it, real life style
- Prep your pans Heat oven to 350 F or 175 C. Grease two 9 inch round pans, line the bottoms with parchment, then flour lightly. If you only have 8 inch pans, use three and shave a few minutes off the bake time.
- Dry ingredients Whisk cake flour, baking powder, and salt together. Set aside, like a little cloud.
- Cream butter and sugar Beat butter and sugar on medium high until pale and fluffy, about 3 to 4 minutes. This is where I usually sneak a taste. If you want to know why this step matters, this Serious Eats explainer is great.
- Add the wet stuff Beat in sour cream and extracts. Add egg whites in two or three portions, mixing on low. It might look a bit uneven, that’s fine.
- Alternate dry and coconut milk Add the dry mix in three parts, alternating with the coconut milk in two parts, starting and ending with dry. Mix just until combined. Fold in toasted coconut if using. The batter should be thick but pourable, like a heavy ribbon.
- Bake Divide batter evenly. Bake 24 to 30 minutes, until the tops spring back and a tester comes out clean with a crumb or two. Don’t overbake, the line between plush and dry is thin as a violin string.
- Cool Let cakes cool 10 minutes in the pans, then turn out to racks and cool completely. Actually, on second thought, give them a bit longer if your kitchen is warm.
Make the sunny pineapple filling
- In a small saucepan, combine crushed pineapple with juice, sugar, cornstarch, and a pinch of salt. Cook over medium, stirring, until bubbly and thick, 5 to 8 minutes. It will go from soupy to glossy pudding, like magic.
- Off heat, stir in lemon juice and butter. Cool to room temp. It thickens more as it sits, so don’t stress if it seems a touch loose at first.
Whip up the not too sweet frosting
- Beat cream cheese and butter until smooth and fluffy, about 2 minutes.
- Add powdered sugar a cup at a time on low. Splash in milk as needed to get a spreadable texture. Beat in vanilla and coconut extract. If it feels too slack, chill 10 minutes and it firms right up.
Assemble without tears, promise
- Level cake tops if needed. Place the first layer on a plate.
- Pipe or swipe a ring of frosting around the edge as a little wall. Spoon in the cooled pineapple filling. Don’t worry if it looks a bit weird at this stage, it always does.
- Top with the second layer. Chill 15 minutes so things set. Then do a thin crumb coat of frosting. Chill again for 10 minutes. Finish with a thicker coat and press shredded coconut onto the sides with your palm. Snowy and cheerful.
Want toasted coconut for the outside. I usually do. Here’s a quick refresher I like from The Kitchn on toasting coconut.

Notes from my slightly messy kitchen
- If your oven runs hot, rotate the pans at the 15 minute mark. I used to forget and one side browned like it spent a week at the beach.
- Strain the pineapple if your can is super juicy, then add the juice back slowly while cooking. I had one batch that never thickened because the ratio was off, my bad.
- Room temp ingredients help the batter emulsify. But if you forget, just mix a minute longer on low and carry on.
- I think this tastes better the next day, the flavors marry up in a cozy way.
Variations I’ve tried, some wins, one whoops
- Coconut rum soak: Brush the layers with a little coconut milk mixed with a splash of rum. Adults clap. Kids get the plain version.
- Sheet cake: Bake in a 9 by 13 inch pan, spread pineapple on top, then frosting. Easier to transport to the potluck.
- Cupcakes: Same batter makes about 24. Core a small bit out and spoon in pineapple. Cute and tidy.
- One miss: I tried a mango passion fruit filling and it tasted great but stayed runny. Looked like a tropical landslide. We ate it with spoons, zero regrets.
Gear that helps, but you’ve got options
- A stand mixer makes the creaming easy. I call it essential. And yet, I’ve creamed by hand with a wooden spoon and sheer stubbornness, it worked.
- Two 9 inch cake pans. If you only have one, bake in batches, cool the pan under cold water, dry, then re grease.
- Offset spatula for smooth frosting. A butter knife plus patience is a fine workaround.
- Cooling racks are handy. In a pinch, flip the cakes onto a clean tea towel.
How to store it without heartbreak
Keep the cake covered and chilled for up to 3 days. Bring slices to room temp for the best texture. Unfrosted cake layers freeze well, wrap tightly and freeze for up to 2 months; thaw in the fridge. Leftover pineapple filling lasts 4 days in a jar. Though honestly, in my house it never lasts more than a day.
How we like to serve it
Cold cake on a warm afternoon is bliss. For birthdays, we add a few goofy candles and a sprinkle of toasted coconut confetti. With coffee in the morning, just a thin slice, which turns into a not thin slice, you know how it goes.
Little pro tips I learned the hard way
- I once tried rushing the cooling step and regretted it because the filling slid out like a tiny lava flow. Chill the layers, quick 10 minutes, totally worth it.
- I overbeat the batter once and the crumb got tough. Mix just until combined, then stop, step away, hands up.
- Toasting the coconut too dark makes the cake taste, well, toasty. Go for pale gold. If it smells like popcorn, you’ve gone a bit far.
- Egg whites whip better without grease, so use a clean bowl. I learned that after a flat meringue situation. Different recipe, same lesson.
FAQ you’ve actually asked me
Can I use whole eggs instead of egg whites
Yes, use 3 whole eggs plus 1 egg white. The cake will be a bit richer and slightly more yellow. Still lovely.
Do I have to use cake flour
Nope. All purpose works if you swap 2 tablespoons of the flour for cornstarch per cup. It’s a small tweak that helps keep things tender.
Can I make the pineapple filling ahead
Absolutely. Make it up to 3 days ahead and keep it chilled. Give it a stir before assembling.
What if I don’t like cream cheese frosting
Swiss meringue buttercream is dreamy here, but takes longer. Or try lightly sweetened whipped cream for a softer, cloudier finish.
Is shredded coconut in the batter necessary
Not at all. I skip it sometimes for a smoother crumb. The coconut milk and extracts carry the flavor anyway.
How do I keep the cake moist
Don’t overbake, and consider a light syrup soak. A tablespoon or two of coconut milk brushed on each layer works a charm.
Can I make it gluten free
I’ve had good luck with a 1 to 1 gluten free baking flour. The crumb is slightly different, but its still tender and happy.
If you make this Coconut Cake with Pineapple Filling, send a pic. It always gets rave reviews form my neighbors, and probably from yours too.
Ingredients
- 2 ½ cups (320 g) all-purpose flour
- 2 cups (400 g) granulated sugar
- 1 tablespoon baking powder
- ½ teaspoon salt
- 1 cup (240 ml) whole milk
- ½ cup (120 ml) coconut milk
- ½ cup (115 g) unsalted butter, softened
- 4 large eggs, room temperature
- 2 teaspoons vanilla extract
- 1 ½ cups sweetened shredded coconut (plus extra for garnish)
- 1 (20 oz / 565 g) can crushed pineapple, drained (reserve ½ cup juice)
- ¼ cup (50 g) granulated sugar (for filling)
- 2 tablespoons cornstarch (for filling)
- 8 oz (225 g) cream cheese, softened (for frosting)
- ½ cup (115 g) unsalted butter, softened (for frosting)
- 4 cups (480 g) powdered sugar (for frosting)
- ¼ cup (60 ml) heavy cream or coconut cream (for frosting)
- Optional: toasted flaked coconut for topping
Instructions
-
1Preheat oven to 350°F (175°C). Grease and flour two 9-inch round cake pans and line the bottoms with parchment paper.
-
2In a large bowl, whisk together the flour, sugar, baking powder, and salt. In a separate bowl, combine milk, coconut milk, softened butter, eggs, and vanilla; beat until smooth. Stir wet ingredients into dry just until combined, then fold in the shredded coconut.
-
3Divide batter evenly between prepared pans and bake for 30–35 minutes or until a toothpick inserted into the center comes out clean. Let cakes cool in pans 10 minutes, then turn out onto a wire rack to cool completely.
-
4Prepare the pineapple filling: in a small saucepan, combine drained crushed pineapple, reserved pineapple juice, ¼ cup sugar, and cornstarch. Cook over medium heat, stirring constantly, until mixture thickens and becomes glossy. Remove from heat and cool to room temperature.
-
5Make the frosting: beat cream cheese and butter until smooth. Gradually add powdered sugar, then beat in heavy cream (or coconut cream) and vanilla until light and fluffy.
-
6Assemble the cake: place one cake layer on a serving plate, spread a layer of pineapple filling over it, then add a layer of frosting around the edge. Top with the second cake layer, frost the top and sides with remaining frosting, and press additional shredded or toasted coconut onto the sides and top. Chill 30 minutes before serving to set.
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!!