tsvkit.org
TSV Toolkit
Sample data Say hi →

Round Numbers in a TSV

round · floor · ceil · truncate · fixed decimals

Fifteen decimal places of floating-point noise is what you get out of most aggregation pipelines, and it makes a table unreadable. This rounds the numbers in the columns you name and leaves everything else — text, dates, IDs, empty cells — untouched. Values that don't parse as numbers are skipped rather than blanked, so running it across a whole file is safe.

round
Drop a .tsv file here, or
ready

How to use

  1. Paste or drop the file.
  2. Name the columns or leave the field blank to round every numeric-looking cell in the file.
  3. Set the decimals and mode. 0 decimals with round gives you whole numbers.
  4. Keep trailing zeros on for money and any column that should read consistently; turn it off if you want the shortest representation.

Mode matters more than it looks

Round goes to the nearest value, with halves going up — JavaScript's Math.round semantics, so 2.5 becomes 3 and -2.5 becomes -2. Note that this is not banker's rounding (round-half-to-even), which is what many financial systems and Python's own round() use; a column of many halves will drift slightly high compared to those.

Floor and ceil always go down and up respectively, including for negatives, where floor moves away from zero. Truncate chops toward zero, which is what a cast to integer does in C and SQL. For quantities that must not be overstated — inventory, budget headroom — floor is the safe one; for anything where you need a guaranteed cover, ceil.

Two cautions

Rounding is lossy and this rewrites the file. Keep the original. It's routine to round for a report and then find that someone re-aggregated the rounded numbers, which compounds the error — round only at the last step, after all summing and averaging is done.

Watch what counts as numeric. A version string like 1.10 parses as a number and will become 1.1. A zip code like 01234 becomes 1234. Both are silent data loss, and both are why naming the columns explicitly is better than rounding everything. With strip thousands commas on, 1,234.5 is read as 1234.5 — convenient for spreadsheet exports, but it will also mangle a text field that happens to look like a comma-formatted number.

FAQ

Can it round to significant figures rather than decimals?

No — decimals only. Significant figures need a per-value magnitude decision that doesn't fit a single column setting.

Does it handle scientific notation?

Input like 1.23e-5 is parsed correctly. The output is written in plain decimal form where possible, so a very small number rounded to 2 decimals becomes 0.00 — which is arguably worse than leaving it alone. Use more decimals for columns spanning wide magnitudes.

Why does 0.145 round to 0.14 instead of 0.15?

Because 0.145 isn't exactly representable in binary floating point — the stored value is very slightly below the true half. Every language that uses IEEE 754 doubles has this behaviour. For exact decimal arithmetic, work in integer cents.

Can it add thousands separators for display?

Not deliberately — adding commas to a data file usually breaks the next tool that reads it. Format in the spreadsheet or report layer instead.

Privacy

100% client-side. No upload. See the privacy policy.