SmartQueryTools

Repair TSV Files Online

Repair malformed TSV files directly in your browser. Fix unbalanced quotes, inconsistent column counts, BOM markers, and mixed line endings — no upload required.

How to repair TSV files

  1. Drop your CSV file. Its raw bytes are read and five checks run straight away: BOM marker, encoding, mixed line endings, inconsistent column count and unbalanced quotes.
  2. Read the results. Each check has a green, amber or red dot and a short detail, such as how many short and long rows were found in the first 100 rows.
  3. If any check fails, click Repair File. If every check passes, the tool reports that the file looks clean and there is nothing to repair.
  4. Compare the Before and After panels, which show the first 20 lines of each version.
  5. Click Download Repaired File. The file keeps its name with -repaired added before the extension.

Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.

Worked example

A water-testing lab exports sample results from an older instrument. When a test was not run, the export drops the trailing fields instead of leaving them empty. Some lines end in CRLF and others in LF, and the lab's database import rejects the file.

Input (TSV)

sample_id	site	ph	nitrate_mg_l
WS-0141	Kaituna Weir	7.2	1.8
WS-0142	Mill Creek	6.9
WS-0143	Kaituna Weir	7.4	2.1
WS-0144	Rowan Bridge

Settings

  • Mixed line endings: found CRLF and LF
  • Inconsistent column count: header has 4 columns, 2 short rows and 0 long rows in the first 5 rows
  • Unbalanced quotes: none found
  • Action: Repair File

Result

sample_idsitephnitrate_mg_l
WS-0141Kaituna Weir7.21.8
WS-0142Mill Creek6.9NULL
WS-0143Kaituna Weir7.42.1
WS-0144Rowan BridgeNULLNULL

Every line now ends in LF. The short rows are padded with commas up to the header's four fields, so the WS-0142 line becomes "WS-0142,Mill Creek,6.9," and WS-0144 gets two trailing commas. Any CSV reader loads those empty fields as missing values, as shown above. No row is removed and no existing value is changed.

Frequently Asked Questions

Does Repair File delete any rows?

No. Every line is kept, including blank lines. Only the BOM, the encoding, line endings, unclosed quotes and short rows are changed.

Why does the tool say my file is clean when another program cannot read it?

The column count check covers the first 100 rows, and the Repair File button only appears when a check fails. Problems further down the file and a semicolon or other delimiter are not detected. Try Change Delimiter for semicolon files, and Convert Encoding if the file uses an encoding other than UTF-8 or Windows-1252.

What does the repaired file look like on disk?

It is UTF-8 text with no byte order mark and LF line endings, the Unix convention. Excel, Python, R, databases and the other tools on this site all read LF files. Values and delimiters are unchanged apart from the padding and any closing quotes.

Related Tools