Significant figures (often called "sig figs") are the digits in a number that carry meaningful contributions to its measurement precision. In science and engineering, every measurement has a degree of uncertainty. Significant figures help communicate how reliable a measurement is based on the tool used to obtain it.
The 4 Golden Rules of Significant Figures
1. Non-Zero Digits: All non-zero digits are always significant. For example, 543 has three significant figures.
2. Sandwich Zeros: Any zeros between two significant digits are significant. In 1005, all four digits are significant.
3. Leading Zeros: Zeros to the left of the first non-zero digit are not significant. They are placeholders. 0.00045 has only two significant figures (4 and 5).
4. Trailing Zeros:
If there is a decimal point, trailing zeros are significant. 50.00 has four significant figures.
If there is no decimal point, trailing zeros are usually not significant. 500 has only one significant figure (5), unless specified by scientific notation or a trailing decimal (500.).
Rounding and Arithmetic Rules
When performing calculations, the precision of your final answer is limited by your least precise measurement:
Multiplication and Division: The result should have the same number of significant figures as the measurement with the fewest significant figures.
Addition and Subtraction: The result should have the same number of decimal places as the measurement with the fewest decimal places.
Example Table
Number
Sig Figs
Explanation
0.0072
2
Leading zeros don't count.
400.0
4
Trailing zeros with decimal count.
10,002
5
Sandwich zeros count.
150
2
Trailing zeros without decimal don't count.
function calculateSigFigs() {
var rawInput = document.getElementById("numberInput").value.trim();
var resultBox = document.getElementById("sigResultBox");
var sigCountEl = document.getElementById("sigCount");
var sigSciNoteEl = document.getElementById("sigSciNote");
var sigDigitsListEl = document.getElementById("sigDigitsList");
var decimalCountEl = document.getElementById("decimalCount");
if (rawInput === "") {
alert("Please enter a numeric value.");
return;
}
// Clean formatting: remove commas and whitespace
var input = rawInput.replace(/,/g, ");
// Check for validity
if (isNaN(parseFloat(input)) && !input.toLowerCase().includes('e')) {
alert("Invalid numeric input.");
return;
}
var numStr = input.replace(/^-/, ""); // Remove negative sign for logic
var coefficient = numStr;
// Handle Scientific Notation
if (numStr.toLowerCase().includes('e')) {
coefficient = numStr.split(/[eE]/)[0];
}
var sigCount = 0;
var sigDigits = "";
var decimals = 0;
// Decimal Places count
if (coefficient.indexOf('.') !== -1) {
decimals = coefficient.split('.')[1].length;
}
// Logic for Significant Figures
if (coefficient.indexOf('.') !== -1) {
// CASE: DECIMAL PRESENT
var parts = coefficient.split('.');
var combined = parts[0] + parts[1];
// Rule: Find first non-zero
var firstNonZeroIndex = -1;
for (var i = 0; i < combined.length; i++) {
if (combined[i] !== '0') {
firstNonZeroIndex = i;
break;
}
}
if (firstNonZeroIndex === -1) {
// All zeros (e.g., 0.00)
// In 0.00, the trailing zeros are significant
sigCount = parts[1].length;
sigDigits = parts[1].split('').join(', ');
} else {
// Rule: Leading zeros (before first non-zero) don't count
// Everything from first non-zero to end counts
var resultStr = combined.substring(firstNonZeroIndex);
sigCount = resultStr.length;
sigDigits = resultStr.split('').join(', ');
}
} else {
// CASE: NO DECIMAL
// Rule: Leading zeros don't count, Trailing zeros don't count
var trimmedLeading = coefficient.replace(/^0+/, '');
var finalTrim = trimmedLeading.replace(/0+$/, '');
if (finalTrim === "") {
// Input was something like 000
sigCount = 1;
sigDigits = "0";
} else {
sigCount = finalTrim.length;
sigDigits = finalTrim.split('').join(', ');
}
}
// Generate Scientific Notation string
var sciVal = parseFloat(input).toExponential();
// Update UI
sigCountEl.innerHTML = sigCount;
sigSciNoteEl.innerHTML = sciVal;
sigDigitsListEl.innerHTML = sigDigits;
decimalCountEl.innerHTML = decimals;
resultBox.style.display = "block";
}