The density of a pencil varies based on the type of pencil, but it can be found by measuring the pencil's mass, preferably in grams, and then dividing the mass by the volume. The formula for density is density = mass/volume.
Usually, the volume of a pencil is less than 1 gram per centimeters to the third, or 1 g/cm^3, which is usually why a pencil will float in water. Fresh water has a density of 1 g/cm^3. Because a pencil typically has a lower density than water, it will float.
The mass of a pencil can be found by measuring its weight in grams. Then, to calculate a pencil's volume, people should multiply the length times the width times the height. Mass is divided by the volume to calculate density.