Format and align CSV data for better readability. Transform messy CSV into neatly aligned columns with consistent spacing and proper quoting.
CSV (Comma-Separated Values) formatting aligns data into neat columns by padding fields with spaces so each column has a consistent width. This makes CSV data much easier to read and review, especially for configuration files, data exports, and debugging. The formatted output remains valid CSV while being more visually organized.
Formatted CSV = Column-aligned fields + Consistent quoting + Proper delimitersCSV formatting works by first parsing all rows to determine the maximum width of each column, then padding each field to align with the widest value in its column. Quoting is applied consistently for fields containing commas, quotes, or newlines.
| Input | Output |
|---|---|
| name,age,city John,30,NYC Jane,25,Los Angeles | name age city John 30 NYC Jane 25 Los Angeles |
| id,product,price 1,Widget,9.99 2,Gadget,24.95 | id product price 1 Widget 9.99 2 Gadget 24.95 |
| a,b,c 1,2,3 4,5,6 | a b c 1 2 3 4 5 6 |