Staaarter

Broken CSV Fixer

Attempts to automatically repair common CSV breakage in one pass: normalizes all line endings to \n, closes an unterminated quoted field left open at end-of-input, and pads or truncates ragged data rows to match the header's cell count. Reports exactly what was fixed alongside the repaired output. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-29
By Staaarter Team
repaircleanup

Overview

Introduction

CSV files break in a handful of predictable ways: a copy-paste cuts off mid-quote, a row ends up with the wrong number of fields, or line endings get mixed after passing through different tools. This tool attempts to fix all three automatically in one pass.

It's best-effort by design: it applies safe, well-understood fixes and clearly reports what it changed, rather than silently guessing at ambiguous cases.

What Is Broken CSV Fixer?

An auto-repair tool for common CSV breakage: unterminated quoted fields, ragged rows, and inconsistent line endings.

It reports exactly which fixes were applied, not just the repaired output, so you can verify the changes make sense for your data.

How Broken CSV Fixer Works

Line endings are normalized first, converting any \r\n or bare \r into \n throughout the input.

The result is parsed; if parsing fails because a quoted field was left open, a closing quote is appended at the very end and the input is re-parsed. Once parsing succeeds, every data row is compared to the header's cell count and padded with empty cells (if short) or truncated (if long) to match.

When To Use Broken CSV Fixer

Use it when a CSV file fails to parse elsewhere and you suspect an unterminated quote or ragged rows are the cause.

It's also a good first pass on messy, hand-edited, or copy-pasted CSV before running more specific cleanup tools.

Features

Advantages

  • Fixes three distinct, common breakage patterns in a single pass.
  • Clearly reports what was actually changed, rather than silently altering the data.
  • Runs entirely client-side.

Limitations

  • The quote-closing heuristic (appending a closing quote at the very end) works for the common single-unterminated-quote case, but won't recover data if the quote was opened in the wrong place entirely.
  • Padding and truncating ragged rows is a structural fix, not a data recovery method - it can't invent missing values or losslessly recover truncated ones.

Examples

Fixing a ragged row and mixed line endings

Input

id,name,active
1,Ada,true
2,Alan

Output

Normalized mixed line endings to \n. Padded 1 row(s) with too few cells.

id,name,active
1,Ada,true
2,Alan,

The file mixed \r\n and \n line endings, which were normalized, and the second data row was short one cell, which was padded with an empty trailing value.

Best Practices & Notes

Best Practices

  • Always review the fix summary before trusting the repaired output, especially for padded or truncated rows, since real data might have been lost upstream.
  • Run the CSV validator afterward to confirm the repaired output is now fully conformant.
  • For a targeted fix (only one kind of problem), use the specific single-purpose tool instead (the incomplete record filler, extra comma remover, or quote adder) for more control.

Developer Notes

The unterminated-quote heuristic is intentionally simple: append one closing quote and retry `parseCsvGrid`. This resolves the overwhelmingly common real-world case (a single field cut off at the very end) without attempting a more speculative repair strategy that could silently misinterpret ambiguous input.

Broken CSV Fixer Use Cases

  • Recovering a CSV file that failed to parse due to a cut-off copy-paste
  • Normalizing line endings and row widths in one pass before further processing
  • A first-pass cleanup step before more targeted CSV tools

Common Mistakes

  • Assuming the fixer recovers lost data; padding and truncation are structural fixes only, they can't reconstruct values that were never captured.
  • Skipping the fix summary and not noticing that several rows were silently truncated, potentially losing legitimate trailing values.

Tips

  • Always check the reported fix counts against what you expect for the file before using the repaired output downstream.
  • If only one specific problem needs fixing, a single-purpose tool (like the incomplete record filler) gives you more predictable, narrower control.

References

Frequently Asked Questions