In more detail
percent error = |measured − true| / |true| × 100. The absolute value makes it a size, not a direction; some lab courses drop it so that the sign shows whether the measurement was high or low. It divides by the true value, not the measured one, so swapping the two changes the answer. Measuring gravity as 9.8 m/s² against the accepted 9.81 gives an error of 0.102%.
Why it matters
It puts errors of different sizes on one scale: being 1 g off on a 10 g sample is far worse than being 1 g off on a 1 kg sample. It needs a known true or accepted value; when you only have two measurements, use the percent difference, |a − b| / ((a + b) / 2) × 100, which treats both values equally. Do not report it to more Significant figures than your measurements support.
Example
boiling point measured 98.6 °C, true 100 °C
|98.6 − 100| / 100 × 100 = 1.4%
measured 12, true 10 → |12 − 10| / 10 × 100 = 20%
measured 10, true 12 → |10 − 12| / 12 × 100 = 16.67%
two measurements 9.78 and 9.84 (no true value)
percent difference = 0.06 / 9.81 × 100 = 0.61%