Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

units.kitchen

cups to grams with ingredient densities

Example results generated on 2026-10-08. Ones using now, today or randomness will differ when you run them: press Run on any example to run it in your browser, after editing it if you like.

Functions

functiondescription
density(ingredient: str)a typical density in g/mL, so volume * density is mass; baking ingredients are spooned and leveled

density

density(ingredient: str): a typical density in g/mL, so volume * density is mass; baking ingredients are spooned and leveled

density("honey")
# → 1.42 g/mL
2 tbsp * density("butter") to g
# → 28.3906 g

More examples

kitchen

# a cup of flour
1 cup * density("flour") to g
# → 125.392 g
# 250 g of sugar in cups
250 g / density("sugar") to cup
# → 1.24316 cup
# a stick of butter
0.5 cup * density("butter") to g
# → 113.562 g