CSV Formatter

Clean up and normalise a CSV file.

Input
CSV input
Output
Result
Options

Detected automatically unless you pick one.

About this tool


Real CSV files are frequently untidy: rows with differing field counts, inconsistent quoting, mixed line endings from files edited on different platforms. This rewrites the file so every row has the same number of fields and quoting follows RFC 4180 consistently.

That normalisation is often what makes a file loadable. A strict parser rejects a row whose field count differs from the header, so padding short rows turns an unusable export into one that imports cleanly.

How to use it

  1. Paste or upload your csvDrop a file onto the input pane, use the file picker, or paste the text directly.
  2. Adjust the options if neededThe defaults suit most input; open Options to change the behaviour.
  3. FormatPress Format, or use Ctrl+Enter (Cmd+Enter on macOS).
  4. Copy or downloadCopy the result, or download it as a .csv file.

Worked examples


Each example below is executed against this tool by the test suite, so what you see is what the tool actually produces.

Ragged rows padded

Input

a,b,c
1,2,3
4,5

Output

a,b,c
1,2,3
4,5,

The short row gains an empty third field so every row has three.

What to watch for


The details that decide whether a conversion is correct, and where information can be lost without any error being raised.

Short rows are padded, not discarded
Every row is widened to match the longest row in the file, with empty cells appended. A warning reports the range of field counts found, which is usually the first sign of a quoting problem in the original export.
Quoting is applied where RFC 4180 requires it
A value is quoted when it contains the delimiter, a double quote or a line break, and embedded quotes are doubled. Values that need no quoting are left bare, which keeps the file readable. Unnecessary quotes in the input are removed.
Line endings are standardised
Mixed CRLF and LF endings, common when a file has passed between Windows and Unix systems, are normalised to LF. Line breaks inside quoted values are preserved, since those are data.
Values are not otherwise altered
No trimming, no type conversion, no case changes. A value with leading spaces keeps them, because whitespace can be significant. Only structure and quoting change.

Limitations


  • Does not trim whitespace or convert types, since both can be significant.
  • Cannot repair a file whose quoting is so broken that field boundaries are ambiguous.
  • Processing happens in your browser, so very large inputs are bounded by available memory. Files above roughly 10 MB are handled but will feel slower, and multi-hundred-megabyte files are better suited to a command-line tool.

Questions


Does this change my data?
No. Values are preserved exactly, including leading and trailing whitespace. Only quoting, padding and line endings change.
Why were rows padded rather than flagged as errors?
Padding produces a file that loads. The warning tells you rows were uneven so you can investigate the source, which is usually a quoting fault upstream.