Dear student,
By definition, density is the amount of matter(mass) per unit volume.
Density of a substance is the characteristic property of the material of the substance. It depends on the nature of the material of the substance.
It can vary with the change in temperature, decreases with increase in temperature and vice versa.
To conclude,density does not depend on shape or size of the substance but depends on the material of the substance.
Regards