The definition of density is mass per unit volume. For any object or sample of a substance, it can be calculated as (mass) divided by (volume).
If two objects or samples with the same volume have different masses, the one with the greater mass has greater density.
If two objects or samples with the same mass have different volumes, the one with the greater volume has smaller density.