Vanillin, the flavoring agent in vanilla, has a mass percent composition of 63.15%C, 5.30%H, and 31.55%O. Determine the empirical formula of vanillin.

A 100 g sample will contain 63.15 g C, 5.30 g H, and 31.55 g O. Convert to moles.

mols C = 63.15/12.01 = 5.258
mols H = 5.30/1.008 = 5.258
mols O = 31.55/16 = 1.972
ratio: C = 5.258/1.972 = 2.666
H = 5.258/1.972 = 2.666
O = 1.972/1.972 = 1.00
To get whole numbers multiply all by 3 to get
C = 2.666 = 7.99
H = 2.666 x 3 = 7.999
O = 1.00 x 3 = 3.00. Round to whole number C8H8O3