Densities tell you how much mass occupies a certain amount of space, so if you need to find the amount of liters something will take up based on its mass, all you need is the density of the material in question. Anybody can do the calculation, provided you can find the specific density you need online. The formula you need is:
From there, convert from the “volume” unit you use for the density to liters, and you'll have your answer.
TL;DR (Too Long; Didn't Read)
To convert from grams to liters using density, divide the mass (m) in grams (g) by the density (ρ) in grams per cubic centimeter (g/cm3). Use the formula for volume. The answer will be in cm3, and 1 cm3 = 1 milliliter = 0.001 liters. Use this to complete the conversion.
What Is Density?
Imagine that you have two boxes containing different amounts of balls. The first has 10 balls in it, and the second has 15 balls in it, but both boxes are exactly the same size. If each box can hold a maximum of 20 balls, the first box is 50 percent full and the second one is 75 percent full, and you know the second one will be heavier than the first. The second box has a higher “density” than the first one because it has more mass crammed into the same amount of space. When scientists or engineers use density, they define it more precisely as the “mass (m) per unit of volume (V).” It has the symbol ρ:
For the box example, if they were cubes with 1-meter-long sides and the balls weighed 1 kilogram each, the density of the first box would be 10 kg per cubic meter, and the second would be 15 kg per cubic meter. For real-world calculations, you’d be looking at something like water (ρ = 1 gram per cubic centimeter) or lead (ρ = 11.3 grams per cubic centimeter). There are many lists of common densities online (see Resources), so you can easily look it up for whatever you need.
Using the Right Units for Density
When you work out any volume based on mass and density, your answer depends on the units you use for both of them. If you use a density in grams per cubic centimeter and a mass in grams, you’ll get the volume at the end in cubic centimeters. If you use a density in pounds per cubic foot and a mass in pounds, the volume at the end will be in cubic feet. You can convert the result to anything you like, but make sure you use the unit you’re using for mass matches the unit of mass in the density.
Divide the Mass by the Density
Look up the density you need online (see Resources). For water, the density is 1 gram/cubic centimeter, or in symbols ρ = 1 g/cm3. If you have 500 g of water, you use the volume equation. To find the volume the water occupies. You can calculate this for water really easily:
Whereas 500 g of lead (ρ = 11.3 g/cm3) occupies:
The same mass of lead occupies much less volume than water because it’s much denser.
Converting to Liters
Now convert the volume in cm3 into liters, noting that 1 cm3 = 0.001 liter = 1 milliliter. Simply convert the cm3 directly into milliliters, and remember that there are 1,000 milliliters in 1 liter.
Using the previous examples, 500 g of water occupies 500 cm3 = 500 milliliters = 0.5 liters.
And 500 g of lead occupies 44.2 cm3 = 44.2 milliliters = 0.0442 liters.