Koerakoonlane is on the right track. Here is a bit more detail.
Density is mass (weight) per unit volume.
To calculate the density of a given object, we must first measure its mass (weight) and then measure its volume, and then divide mass by volume.
We begin by choosing units of measure. In the metric system, density can be in, for example, kilograms per litre (kg/l) or grams per cubic centimeter (g/cc). In the US system, it is likely to be pounds per cubic foot. Make sure not to accidentally change units of measure. The best way to do this is to include the units of measure as you write out the calculations.
Mass and weight are not technically the same thing, but, on planet earth, they're usually close enough. (Mass does not change. Weight does. An object taken into outer space has the same mass, but is weightless.)
Our measurement methods vary with the type of material.
The weight of a solid is generally measured with a scale. For a liquid, we measure with a scale, but have to adjust out the weight of the container. This adjustment is called the "tare." For a gas, weighing is a bigger challenge. We have to contain it, weigh it in the container, and then empty the container to a vacuum, and use the difference.
The volume of an object is easy to calculate if it is some ordinary shape, such as a cube, or a parallelogram. The volume of more complex shapes is calculated either with complex formulas, or by the use of calculus.
These calculations assume that the item has uniform density. But if you tried to calculate, say, the density of a piece of wood that was partly knotty and partly smooth growth, the actual density of the parts might vary. You've actually calculated the average density.
Once you know the mass and the volume, divide mass by volume to get mass over volume, which is density, in a unit which is a unit of mass over a unit of volume, such as pound per cubic foot or pounds per gallon.
By the way, an easy way to remember the density of water is, "a pint a pound, the world around." Anything that floats in water has a lower density. Anything that sinks has a higher density.