Preheat oven to 350°F (175°C). Prepare cupcake pans with liners or grease and flour cake pan(s).
In a medium bowl, whisk together ½ teaspoon salt, 3 teaspoons baking powder, and 2 ½ cups (310 g) all-purpose flour. Set aside.
In a large bowl, combine 1 cup (227 g) unsalted butter, melted, and 1 ½ cups (297 g) granulated sugar. Using a hand mixer or stand mixer, beat until smooth.
Add 4 large eggs, one at a time, beating briefly after each egg until incorporated. Mix in 1 teaspoon (5 ml) vanilla extract.
Add the dry ingredients alternately with 1 ¼ cups (296 ml) buttermilk, beginning and ending with the flour mixture (i.e., dry–liquid–dry–liquid–dry). Mix gently between additions and stop as soon as the batter is just combined. Scrape the sides and bottom of the bowl as needed.
Divide batter into prepared pans and bake according to pan size/yield: - 24 cupcakes: 14–17 minutes - Two 9-inch round pans: 24–27 minutes - Two 8-inch round pans: 25–33 minutes - 9×13-inch pan: 30–40 minutes
Remove cakes from oven and let cool completely before removing from pans and before frosting.
Chocolate frosting (optional) — dry mix: In a large bowl, whisk 3 ½ cups (396 g) powdered sugar, ½ cup (40 g) unsweetened cocoa powder, and ¼ teaspoon salt until no lumps remain.
Chocolate frosting — base: Beat 1 cup (226 g) unsalted butter, softened, in a mixer until smooth. (If using a hand mixer, use a very large bowl to avoid powdered sugar dusting.)
Chocolate frosting — combine: Add the powdered sugar/cocoa mixture to the butter one cup at a time, beating on medium speed until the mixture is crumbly and combined. Mix in 1 teaspoon vanilla extract.
Chocolate frosting — finish: Add 2–3 tablespoons (30–45 ml) heavy whipping cream, 1 tablespoon at a time, mixing after each addition until the frosting is smooth and at the desired spreading consistency. Frost cake or cupcakes.
Vanilla frosting (optional) — dry mix: In a large bowl, whisk 4 cups (452 g) powdered sugar and ½ teaspoon salt until no lumps remain.
Vanilla frosting — base: Beat 1 cup (227 g) unsalted butter, softened, in a mixer until smooth. (If using a hand mixer, use a very large bowl.)
Vanilla frosting — combine: Add the powdered sugar to the butter one cup at a time, beating on medium speed until the mixture is crumbly and combined. Mix in 1 teaspoon (5 ml) vanilla extract.
Vanilla frosting — finish: Add 2–3 tablespoons (30–45 ml) heavy whipping cream, 1 tablespoon at a time, mixing after each addition until the frosting is smooth and at the desired consistency. Frost cake or cupcakes.