The trick is easy. Start by making sure your cake is fully baked, as an underdone dessert is far more likely to stick to the pan. “The edges of a fully baked cake will start to come away from the sides of the pan,” explains Chef Angela Garbacz, baking expert and author of Perfectly Golden: Adaptable Recipes for Sweet and Simple Treats. “Also, when you gently poke the center of the cake, it should not have any give and will bounce back immediately. You can also insert a paring knife or toothpick into the center to check for doneness. If it comes out clean, the cake is baked,” she adds. Next, give your cake sufficient time to cool—ideally to room temperature for about an hour. According to Garbacz, allowing layer cakes to cool in their pans lets the outside of the cake steam a bit, which helps keep the edges super soft. “But for cakes such as banana bread or pound cake, I like to unmold them from their pans after about 10 minutes. These cakes do well cooling outside their pans so they form a bit more of a crust.” You can take them out of their pans and let them cool directly on the serving plate, on parchment paper, or on a cooling rack. Finally: the moment of truth. “Start by running a butter knife around the edge of the pan, between the cake and the pan,” says Garbacz. “Make sure the knife stays in contact with the side of the pan the entire time—this ensures you will have a nice edge on the cake, and you aren’t cutting into the cake itself.” If you greased your pan sufficiently before baking, this should do the trick. If your cake is really stuck, and you can see that the butter knife method won’t work, wrap the cake and pan in plastic wrap and freeze for at least six hours or up to a day. A cold cake is less likely to fall apart when you start to pry it out of the pan. Once chilled, slide the butter knife around the rim of the pan once more. Then flip the pan over and tap an edge on a board while holding the pan at a 45-degree angle to pop the entire cake out. Still no luck? Try this hack: Run a small butter knife or offset spatula around the cake rim to loosen it from the sides of the pan. Working around the whole cake, insert two forks on the opposite ends of the pan and use the forks as levers, squeezing and nudging the cake to loosen it. Flip the pan over the board, and the cake should come out. If none of these methods work, just frost the cake and serve it directly from the pan like a sheet cake. Life is short! Then opt to never deal with a baked-in cake again.