TBToolbox
Developer Tools

CSV Formatter

CSV Formatter runs the custom comma parser and writes each parsed row with a consistent cell escaper. It quotes values containing commas, quotes, or line breaks and doubles internal quotes. It does not sort, align, infer types, enforce uniform column counts, preserve the original dialect or line endings, reject every malformed quote sequence, neutralize spreadsheet formulas, or validate a header.

Runs locally — files stay on your device
Quick answer

Does formatting change row order or values intentionally?

No, but it normalizes quoting and line endings after parsing.

Formatting normalizes a parsed CSV dialect

CSV lexical forms can differ while representing similar cells. Re-serialization replaces those choices with one quoting policy.

How it works

The parser creates row arrays, csvCell serializes values, commas join cells, and line feeds join rows.

Key concepts

LF output

Original CRLF/CR line endings are normalized.

Meaning follows this parser

If the parser misinterprets malformed input, formatting preserves that interpretation.

When to use it

  • Normalize common CSV quoting.
  • Make generated CSV easier to compare.
  • Repair inconsistent but parseable quoting.

When not to use it

  • Do not expect malformed input repair guarantees.
  • Do not use it as a schema or row-width validator.
  • Do not assume formulas become safe.

Worked examples

Unneeded quotes

Input
"a",b
Expected output
a,b

Safe cell loses optional quotes.

Comma

Input
"a,b",c
Expected output
"a,b",c

Required quotes remain.

Uneven rows

Input
a,b\n1
Expected output
a,b\n1

No width correction.

Common mistakes

Calling it validation

Uneven or questionable input can pass. Correction: Run explicit structural checks.

Expecting preserved line endings

Output uses LF. Correction: Convert afterward if required.

Ignoring formula injection

Quoting does not neutralize spreadsheet formulas. Correction: Apply destination policy.

Best practices

  • Keep a source copy.
  • Validate expected columns and row counts.
  • Test with the destination importer.

Related operations and differences

CSV Column Remover

Choose CSV Column Remover when you need to remove one CSV column by header name.; use CSV Formatter specifically for csv format.

CSV to JSON

Choose CSV to JSON when you need to convert a header-based CSV table to JSON.; use CSV Formatter specifically for csv format.

CSV to TSV

Choose CSV to TSV when you need to convert comma-separated data to tab-separated data.; use CSV Formatter specifically for csv format.

CSV Transposer

Choose CSV Transposer when you need to swap rows and columns in CSV data.; use CSV Formatter specifically for csv format.

JSON Beautifier

Choose JSON Beautifier when you need to format JSON with readable indentation.; use CSV Formatter specifically for csv format.

JSON to CSV

Choose JSON to CSV when you need to convert an array of JSON objects to CSV.; use CSV Formatter specifically for csv format.

Limitations and privacy

  • One custom comma dialect.
  • No row-width/header/schema/type validation, strict error positions, formula defense, configurable line ending, sorting, streaming, or download.

The pasted data is parsed and transformed locally in this browser.

Frequently asked questions

Are rows reordered?

No.

Are line endings preserved?

No, output uses line feeds.

Does it validate column counts?

No.

Are quotes normalized?

Yes.

References