Decimal place formatter
Reformat every number inside a block of text to a fixed number of decimal places, rounding on the decimal string itself and padding with zeros, while dates and identifiers stay untouched.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Formatted text
Decimal-string rounding without floating point; all other characters stay untouched.
Enter text to see the result
Only standalone numbers are touched: digits glued to letters (v2.0, abc123) and digits between hyphens (dates like 2024-05-06, ranges like 3-5) are left as they are.
What this tool does
- Normalise messy decimals in a report (1.005, 2.5678, -0.5) to two places before pasting it into a doc.
- Switch to 4 or 6 places when you need more precision, or 0 to round to whole numbers.
- Check how many numbers were recognised versus actually rewritten.
Example
Input
price 1.005 and 2 items on 2024-05-06
Output
price 1.01 and 2.00 items on 2024-05-06
Only standalone numbers change; the date is held together by hyphens and stays as it is.
Frequently asked questions
What rounding rule is used?
Round-half-up on the decimal string itself (1.005 → 1.01, 3.9 at 0 places → 4). Everything runs on BigInt over the digit string, never through floating point, so long values such as 12345678901234567890.5 keep their precision.
Which numbers are left alone?
Three kinds: digits glued to letters or underscores (v2.0, abc123, snake_case_1), digits between decimal points (1.2.3), and digits between hyphens (dates like 2024-05-06, ranges like 3-5). The leading-dot form .5 is skipped too, so a full stop is not swallowed into a number.
How are negative numbers handled?
A - or + directly attached to the digits counts as a sign: -1.235 becomes -1.24 at two places. A result that rounds to zero loses the sign (-0.01 at 0 places → 0). A minus with spaces around it (3 - 5) is just a separator.
Does it add or remove numbers?
Short values are padded with zeros (3.1 → 3.100) and long ones are truncated with rounding; no number is added or removed, and thousands separators are untouched (in 1,234.5 the 1 and the 234.5 are treated as separate numbers and the comma stays).
What does "rewritten" count?
A number whose output is byte-identical to its input is not counted; only real changes (padding, truncation, rounding, a dropped minus) increment the counter — a quick way to confirm the run did something.
Keywords:decimal placesroundfixed point