What is Density?
The density of a substance is the measure of its mass per unit volume.
What is the formula to calculate density?
ρ=m/V
Where ρ=density in kg/m^{3}
m = mass in kg
V = Volume in m^{3}
What does the formula for density mean?
Mathematically, density is directly proportional to mass and inversely proportional to the volume. This means that density will behave in a similar manner to mass and in the opposite manner to volume.
For instance, there are two bags. One filled with feather and the other with rocks. They are both of the same size but different weights. Because the mass of the bag of rocks is greater, its density will be higher as well.
How to calculate the density of solids?
Solids can be of two types:

Regular solids

Irregular solids
Regular objects have a fixed geometrical shape. That is why the formulae for their volume are already devised.
To calculate the density of a regular object for example a cube, cuboid or sphere, simply use the aforementioned formula. A density calculator makes use of the mass and volume of an object to find its density.
Measure the mass using a beam balance and the volume using an appropriate apparatus to measure the lengths of the object’s sides according to the size of the object in question. Then use an appropriate formula.
Density calculators provide answers in kg/m^{3}. Therefore, keep in mind that your readings are in S.I units. (Kg for mass and m^{3} for volume).
For irregular objects, the salient remains similar, however the process to calculate the density is different.
Mass is measured in the same way. To measure the volume, fill up water in a graduated cylinder and note down the volume. Add the irregular in the graduated cylinder so that now the volume of water increases. Note down the new volume. Subtract the new volume from the old one to find the volume of the object. Finally, put the values in the formula for density to get your result.
How to calculate the density of liquids?
The only trick here is the method to find a liquid’s mass. To do this, take a graduated cylinder measure its mass. Add a known volume of the liquid in the cylinder and remeasure it. The difference between the two readings will give you the mass. To get your answer, just insert values in the density formula.
Example Questions
Q.1.An object has a volume of 100〖cm〗^{3} and a mass of 50g. What is its density?
Answer:

To calculate the density, the first step is to convert the units.
100〖cm〗^{3}= 0.0001m^{3}
50g = 0.05 kg 
Insert the values in the formula
ρ=m/V
=0.05/0.0001
=500 kg/m^{3}
Q.2. A geologist wants to calculate the density of a metal sphere of radius 15 cm and mass 30g. Find the density.
Answer:

Convert all units into S.I units.
15 cm = 0.15 m
30g = 0.03kg 
Calculate the volume
Volume of a sphere = 4/3 πr^{3}
= 4/3π〖(0.15)^{3}
= 0.014 m^{3}  Insert the values in the formula
ρ=m/V
=0.03/0.014
=2.14 kg/m^{3}
Q.3. Water has a density of about 1 g/cm3. The density of a wooden block is 0.9 g/cm3. The density of an iron block is 7.9 g/cm3. When both the blocks are put in water, which one will float or sink?
Answer: The wooden block will float and the iron block will sink. This is because the wooden block has a lesser density than water and the iron block has a greater density than water.
Q.4. An irregular object of mass 10g is immersed in water in a graduated cylinder. Calculate its density.
Answer:

Calculate the volume of the object
New volume – old volume
= 75 – 50
= 25 ml 
Convert all units into S.I units
25ml = 0.000025 m^{3}
10g = 0.01kg 
Insert the values in the formula
ρ=m/V
= 0.01/0.000025
= 400 kg/m^{3}