CSV Formatter
About this tool
About CSV Formatter
CSV files collected from different tools rarely agree on the details: one quotes every cell, another quotes nothing, line endings switch between Windows and Unix halfway through, and stray spaces and blank lines creep in from hand edits. The formatter rewrites the file in one consistent style without changing what the cells mean. Choose quoting only where it is required, on every cell, or on non-numeric cells; pick CRLF or LF line endings; keep or change the delimiter. Trim spaces removes padding around values, Remove empty rows drops lines with no values, and Pad short rows fills missing trailing cells so every row has the same width. For files that will be opened in a spreadsheet, add a BOM so Excel reads UTF-8 correctly and escape cells that start with =, +, - or @ so they are shown as text instead of being run as formulas. Everything happens in your browser.
Built and maintained by Abhi JainUpdated
How to Format a CSV File
- 1
Paste or open the CSV
Paste the data or open a file. Click Sample to see a messy example.
- 2
Pick the style
Choose Quotes, Line endings and Output delimiter, and tick Trim spaces, Remove empty rows, Pad short rows, Escape formulas or BOM for Excel as needed.
- 3
Copy or download
The summary shows how many cells were trimmed and rows removed or padded. Copy the result or download formatted.csv.
CSV Formatter: questions and answers
Does formatting change my data?
Only if you ask it to. Quoting, line endings and delimiters change how the file is written, not the values. Trim spaces and Escape formulas do change cell text, so leave them off if spaces are meaningful.
Should I use CRLF or LF line endings?
RFC 4180 specifies CRLF, and Excel and most Windows software expect it. Unix tools and many programming libraries accept either. Pick CRLF unless the target system asks for LF.
What is CSV formula injection?
A cell starting with =, +, - or @ can be run as a formula when the file is opened in a spreadsheet, which attackers can abuse. Escape formulas prefixes such cells with an apostrophe so they display as text. Plain negative numbers are left alone.
When should every cell be quoted?
Some older importers and databases expect every field in quotes. Otherwise, quoting only where needed keeps the file smaller and is what most programs write.
Related Tools
- CSV ValidatorFind ragged rows, quoting errors, duplicate headers and type problems in a CSV, with line numbers.
- CSV Delimiter ConverterSwitch a CSV between comma, semicolon, tab, pipe or any custom delimiter, keeping quoted cells intact.
- CSV CleanerTrim spaces, remove duplicates, fix case, find and replace, split and merge columns, fill blanks. All undoable.
- CSV Viewer & EditorOpen, edit, sort, filter and search big CSV files like a spreadsheet, then export CSV, TSV or JSON.