Main calculator
Select a mode, choose a substance or gas, enter values, and control precision. Density is required for ordinary mass-volume conversion.
Batch grams-to-liters conversion
Enter one mass per line. Optionally add a label after a comma. All rows share one density and one unit setup.
Two-component mixture density
Estimate combined density from two masses and two densities. Optional contraction accounts for non-additive final volume.
Saved calculation history
History is stored only in this browser. It is not sent to the server.
Density reference library
These are representative values. Product composition, temperature, pressure, moisture, and packing may change actual density.
| Substance | Category | Density | Reference note |
|---|---|---|---|
| Water | Liquid | 0.9982071 g/mL | Approximate density at 20°C |
| Seawater | Liquid | 1.025 g/mL | Typical ocean water near 20°C |
| Whole Milk | Food | 1.03 g/mL | Typical value near room temperature |
| Olive Oil | Food | 0.915 g/mL | Typical value at 20°C |
| Vegetable Oil | Food | 0.92 g/mL | Representative cooking oil value |
| Coconut Oil | Food | 0.924 g/mL | Approximate liquid density |
| Honey | Food | 1.42 g/mL | Typical value; moisture content varies |
| Maple Syrup | Food | 1.33 g/mL | Typical value at room temperature |
| Granulated Sugar (bulk) | Dry ingredient | 0.845 g/mL | Loose bulk density; packing changes results |
| Brown Sugar (packed) | Dry ingredient | 0.93 g/mL | Approximate packed bulk density |
| All-Purpose Flour (scooped) | Dry ingredient | 0.593 g/mL | Bulk density depends strongly on technique |
| Bread Flour | Dry ingredient | 0.6 g/mL | Approximate loose bulk density |
| Table Salt (bulk) | Dry ingredient | 1.217 g/mL | Loose bulk density |
| Rice, uncooked (bulk) | Dry ingredient | 0.85 g/mL | Typical loose bulk density |
| Butter | Food | 0.911 g/mL | Approximate density near 20°C |
| Ethanol | Chemical | 0.7893 g/mL | Approximate density at 20°C |
| Isopropyl Alcohol | Chemical | 0.785 g/mL | Approximate density at 20°C |
| Acetone | Chemical | 0.7845 g/mL | Approximate density at 20°C |
| Glycerin | Chemical | 1.261 g/mL | Approximate density at 20°C |
| Gasoline | Fuel | 0.745 g/mL | Representative value; blend varies |
| Diesel Fuel | Fuel | 0.832 g/mL | Representative value at 15°C |
| Kerosene | Fuel | 0.81 g/mL | Representative value at 15°C |
| Motor Oil | Industrial | 0.87 g/mL | Representative value; grade varies |
| Mercury | Metal | 13.546 g/mL | Approximate density at 20°C |
| Aluminum | Solid | 2.7 g/mL | Typical solid density |
| Steel | Solid | 7.85 g/mL | Typical carbon steel density |
| Copper | Solid | 8.96 g/mL | Typical solid density |
| Concrete | Construction | 2.4 g/mL | Representative cured concrete density |
| Dry Sand (bulk) | Construction | 1.6 g/mL | Bulk density depends on grading and packing |
| Wet Sand (bulk) | Construction | 1.92 g/mL | Representative bulk density |
| Soil (bulk) | Construction | 1.33 g/mL | Highly variable bulk density |
| Air (density method) | Gas | 0.001204 g/mL | Dry air near 20°C and 1 atm |
| Oxygen gas (density method) | Gas | 0.001331 g/mL | Approximate at 20°C and 1 atm |
| Carbon dioxide gas (density method) | Gas | 0.001842 g/mL | Approximate at 20°C and 1 atm |
| Custom density | Custom | 1 g/mL | Enter your own density |
Guide to grams, liters, and density
How to use the calculator
Why density matters
Temperature effects
Gas calculations
Dry ingredients
Precision and rounding
Worked examples
Limitations
Frequently asked questions
Formula used
Grams measure mass. Liters measure volume. A direct conversion is only possible when density is known. The basic relationship is density = mass ÷ volume. Rearranging it gives volume = mass ÷ density and mass = volume × density.
When mass is in grams and density is in grams per milliliter, the immediate result is milliliters. Divide milliliters by 1,000 to obtain liters. Therefore, the common calculator formula is liters = grams ÷ (density × 1000).
How to use this calculator
Choose the calculation mode first. Select a material preset or enter a custom density. Enter the mass or volume, select the matching unit, and choose the desired output unit. Adjust purity, moisture, temperature, precision, notation, or rounding when those settings apply. Press Calculate to view the main answer, normalized values, formula, substituted values, and warnings.
For gases, select the gas mode. Enter mass, molar mass, temperature, pressure, and a compressibility factor. Use a factor of one for an ideal-gas estimate. Use a measured factor when reliable real-gas data is available.
Why density matters
One liter of water and one liter of oil do not have the same mass. Water near room temperature is close to one gram per milliliter. Many cooking oils are near 0.92 grams per milliliter. A lower density means the same mass occupies more volume. A higher density means it occupies less volume.
Density may describe a pure liquid, solid material, gas, powder, or granular product. Powders and grains require bulk density rather than true particle density. Bulk density includes the air spaces between particles.
Temperature effects
Most liquids expand as temperature increases. Their density usually decreases because the same mass occupies a larger volume. This calculator can apply a simple linear coefficient for selected substances. The feature is useful for rough estimates, but it does not replace a verified density table or laboratory measurement.
Temperature effects are especially relevant for fuels, alcohols, oils, and precision liquid handling. Extremely high or low temperatures can make a linear correction unreliable. Phase changes also invalidate a simple liquid-density model.
Gas calculations
Gas density is strongly controlled by temperature and pressure. The ideal-gas mode uses PV = nRT. Mass is converted to moles using molar mass. The calculator then solves for volume. A compressibility factor can modify the result for non-ideal behavior.
The ideal-gas model works best at relatively low pressures and temperatures well above condensation. High-pressure process calculations may require a cubic equation of state or reliable compressibility charts.
Dry ingredients and bulk materials
Flour, sugar, rice, salt, sand, and soil do not have one universal mass-to-volume ratio. Results depend on packing, moisture, particle size, and measurement technique. A packed cup can contain much more material than a loosely filled cup. Use a scale when consistent recipe or manufacturing results are important.
The kitchen fraction display rounds US cups to a familiar fraction. It is a convenience estimate, not a high-precision result.
Precision and rounding
More decimal places do not always mean more accuracy. The result cannot be more reliable than the density input. Use significant figures that match the quality of the source data. Scientific notation is helpful for very small or large results. Engineering notation uses exponents in multiples of three.
Worked examples
Example 1: water
Assume 1,000 grams of water at a density of 0.9982 grams per milliliter. Volume equals 1,000 divided by 0.9982, which is about 1,001.8 milliliters. That equals about 1.0018 liters.
Example 2: cooking oil
Assume 750 grams of cooking oil at 0.92 grams per milliliter. Volume equals 750 divided by 0.92, or about 815.22 milliliters. The result is about 0.81522 liters.
Example 3: honey
Assume 500 grams of honey at 1.42 grams per milliliter. The estimated volume is about 352.11 milliliters, or 0.35211 liters.
Example 4: oxygen gas
Gas calculations use molar mass, temperature, and pressure. The same oxygen mass occupies different volumes at different pressures. This is why a fixed grams-to-liters factor is not appropriate for gases.
Accuracy and limitations
Preset densities are representative rather than certified. Commercial products may contain additives or varying moisture. Temperature adjustment is approximate. Mixture volume may not be additive. Gas calculations may require real-gas corrections. For regulated laboratory, medical, fuel-transfer, or industrial work, use traceable measurements and approved reference data.
Frequently asked questions
Is one gram always one milliliter?
No. That approximation only works reasonably well for water near common temperatures. Other materials can differ substantially.
How many grams are in one liter?
Multiply one thousand milliliters by density in grams per milliliter. Water is close to one thousand grams per liter. Oil is generally lighter. Honey is generally heavier.
Can this calculator convert flour grams to liters?
Yes, using a bulk-density estimate. The result is approximate because flour packing changes volume.
What density should I use?
Use a measured density for the exact substance, composition, temperature, and pressure whenever possible. Otherwise, choose the closest preset and treat the result as an estimate.
Developer and data features
The calculator uses server-side PHP for core computations and validation. Client-side scripts add live interface behavior, browser history, favorites, CSV handling, result copying, and share-link generation. No database is required.
- Compatible with PHP 8.0 and later.
- Uses strict types and escaped output.
- Rejects zero or negative density and pressure.
- Supports comma-separated batch rows.
- Stores optional history in localStorage.
- Provides printable results and responsive controls.
- Uses a single PHP file for simple deployment.