Method Deck / cooking
Cups to grams for common ingredients
Converts a volume in US cups to a weight in grams for a small set of common cooking ingredients using cited density values.
Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.
Try it
Inputs
- ingredient (string, required) one of: all_purpose_flour, granulated_sugar, butter, water, white_rice_uncooked : Ingredient to convert
- cups (number, US cups, required) min 0 : Volume in US cups
Outputs
- grams (g): Equivalent weight in grams
Steps
- Look up the grams-per-cup density for the chosen ingredient from the cited table.
- grams = cups * grams_per_cup.
- Round the result to the nearest whole gram.
Constants
- all_purpose_flour_g_per_cup = 120 g/cup (source)
- granulated_sugar_g_per_cup = 200 g/cup (source)
- butter_g_per_cup = 227 g/cup (source)
- water_g_per_cup = 236.588 g/cup (source)
- white_rice_uncooked_g_per_cup = 185 g/cup (source)
Sources
- FoodData Central, household measure weights for sugar, butter, water (1 US cup = 236.588 mL, density approx. 1 g/mL), and uncooked white rice (USDA Agricultural Research Service, 2026-09-30T20:10:00Z) - Source for the sugar, butter, water, and rice grams-per-cup figures.
- Ingredient Weight Chart (all-purpose flour: 1 cup = 120 g, dip-and-sweep method) (King Arthur Baking Company, 2026-09-30T20:10:00Z) - Source for the all-purpose flour grams-per-cup figure used by professional and home bakers.
Worked example and test vectors
| Name | Inputs | Answer |
| worked example | {"ingredient":"all_purpose_flour","cups":2} | 240 g |
| test vector: water | {"ingredient":"water","cups":1.5} | 355 g |
Published card
- Address:
8dcf2e2cf99f0e3ab9a95ddb8928e9b1
- Made at:
2026-09-30T22:39:30.722Z
- Method sha256:
fb125ef277436ddba0480d19ff3a3b90ebbaebef8eb785bcdf97d51b77f03cc6