It's usually fairly easy to calculate the volume of a liquid in a container with a regular shape, such as a cylinder or cube. All you have to do is use the appropriate mathematical equation to calculate the capacity of the container, then measure the level of the liquid and make the necessary adjustment. It's more challenging when the container doesn't have a regular shape, and that's most of them. The challenge disappears if you know the density of the liquid, though. All you have to do is weigh the container and the liquid, subtract the weight of the container, and use the density of the liquid to derive your answer.
TL;DR (Too Long; Didn't Read)
You can calculate the volume of a liquid from its weight if you know the density of the liquid. You can usually look up density in a table. If you have a solution, you need to know the relative proportions of solute and solvent to calculate its density.
Definition of Density
Scientists define the density (∂) of a solid, liquid or gas as the mass (M) of the substance per unit volume (V). In mathematical terms, this is:
∂ = M/V
You determine the mass of a substance by weighing it. This can cause some confusion, because weight and mass are different quantities. Mass is a measure of the amount of matter whereas weight is a measure of the force of gravity. However, it's common to use kilograms, grams or pounds for both weight and mass, and this is because, for earthbound objects, the relationship between mass and weight doesn't change. This isn't true for objects in space, but few scientists have the opportunity to make measurements in space.
Finding the Density of a Liquid
In many cases, you can look up the density of a liquid in a table. Some are easy to remember. For example, the density of water is 1 g/ml, which is equivalent to 1,000 kg/m3, although the value in Imperial units is a little less memorable: 62.43 lb/cu ft. Other densities, such as those of acetone, alcohol or gasoline, are readily available.
If you have a solution, you need to know the relative concentrations of solvent and solute to calculate its density. You determine this by weighing the solute before adding it to the solvent. If you don't know the proportions, you can't calculate density and therefore can't derive the volume of the solution simply by weighing it.
Procedure for Calculating Volume
Because you need to know the weight of the liquid independent from the weight of the container, you need a second container to hold the liquid while you weigh the first one.
Weigh the Container
It's better to weigh the container before you add the liquid rather than pouring the liquid out and weighing it. Small amounts of liquid can cling to the sides of the container and will be part of the weight if you use the second method. This small inaccuracy can be significant when weighing very small quantities.
Weigh the Liquid
Pour the liquid into the container and record the weight of the container plus the liquid. Subtract the weight of the container to get the weight of the liquid.
Look up or calculate the density of the liquid, then determine the volume of the liquid by dividing the mass of the liquid by the density.
∂ = M/V so V = M/∂
Make sure to express density in units compatible with the mass. For example, if you measure mass in grams, express density in grams/milliliter, but if you measure mass in kilograms, express density in kilograms/cubic meter.