The factors affecting density of a substance are its mass, volume, physical state of matter and the ambient temperature.
Density of a substance is directly proportional to its mass. while inversely proportional to its volume and ambient temperature. Density of a substance also varies with the change in its physical state.