Why cups to grams depends on the ingredient
American recipes measure by volume: cups, tablespoons and teaspoons. Most of the rest of the world, and nearly every professional baker, measures by weight. The catch is that a cup is a volume and a gram is a mass, so there is no single conversion factor. A cup of water weighs 240 g, but a cup of all-purpose flour weighs only about 127 g, a cup of granulated sugar about 204 g, and a cup of honey a hefty 341 g. If you treat flour like water you will add nearly twice as much as the recipe intended, and the cake will be dry and dense.
This converter stores a density (grams per milliliter) for 24 common ingredients: all-purpose flour 0.53, bread flour 0.54, granulated sugar 0.85, powdered sugar 0.56, packed brown sugar 0.93, butter 0.96, milk 1.03, honey 1.42, cocoa powder 0.51, rolled oats 0.38 and so on. It first turns whatever you typed into milliliters (1 US cup = 240 mL, 1 tablespoon = 15 mL, 1 teaspoon = 5 mL, 1 fluid ounce = 29.57 mL), multiplies by the density to get grams, then divides by 28.3495 for ounces and 453.592 for pounds. Enter a weight instead and it runs the same math in reverse, so you can go from grams back to cups just as easily.
Which cup? 240 mL vs. 236.6 mL
The FDA "legal" cup used on US nutrition labels is exactly 240 mL, and that is what this tool uses. The older US customary cup is 236.59 mL, a difference of about 1.4%, which is smaller than the error from how you fill the cup. A UK or Australian metric cup is 250 mL and a Japanese cup is 200 mL, so check where a recipe comes from before you convert it.
Flour is the ingredient where technique matters most. King Arthur Baking standardizes on 120 g per cup, measured by fluffing the flour, spooning it into the cup and leveling with a knife. Our 0.53 g/mL density gives 127 g, close to the USDA figure of 125 g for a spooned cup. Dip the cup straight into the bag and press it against the side and you can easily end up at 150-160 g. Brown sugar is the opposite case: recipes assume it is firmly packed, which is why our density is 0.93 rather than the loose 0.72 or so you would get by pouring it.
Worked example and practical tips
A cookie recipe calls for 2 1/4 cups of all-purpose flour. 2.25 cups x 240 mL = 540 mL; 540 x 0.53 = 286 g, or about 10.1 oz. If your bag lists 120 g per cup, you would scale that to 270 g; either figure is well inside the normal range. For 1/2 cup of butter (one stick) the tool returns 120 mL x 0.96 = 115 g, which matches the 113 g printed on the wrapper closely enough.
Small quantities are where volume and weight really diverge: 1 teaspoon of table salt is 6 g, but 1 teaspoon of baking powder is 4.5 g and 1 teaspoon of active dry yeast only 3.8 g. When you need precision for bread, macarons or laminated dough, weigh everything on a digital scale and use this page to translate the recipe once. For everyday cooking the conversions here are plenty accurate.