Skip to main content

CSV Formatter

Clean up messy CSV data — auto-detect or choose the input delimiter, trim stray whitespace, and re-serialize with a consistent delimiter and RFC 4180 quoting (quote only when needed, or always).

Input

Output

Formatted CSV
 
Was this helpful?

More ways to use this tool

REST API

curl -X POST https://api.iotools.cloud/v1/tool/csv-formatter \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "csvInput": "Name, Age,City\n  Alice , 30,New York\nBob,25, Bos…",
    "inputDelimiter": ",",
    "outputDelimiter": ",",
    "quoteStyle": "as-needed",
    "trimWhitespace": "true"
  }'

Swap in your own key from your account. The tool's fields are the body — no wrapper.

Ask an AI agent

Use the IOTools `csv-formatter` tool (CSV Formatter) on this input:

YOUR_INPUT_HERE

Paste this at any agent connected to the IOTools MCP server, then add your input.

Embed widget

<iframe
  src="https://iotools.cloud/embed/csv-formatter/"
  width="100%" height="520" frameborder="0" scrolling="no" loading="lazy"
  title="CSV Formatter — iotools.cloud"
  sandbox="allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox"
  allow="clipboard-write"
  style="width:100%;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden"></iframe>
<script src="https://iotools.cloud/embed.js" async></script>

Drop this into your own page — free, no key required, just a link back.

Cost per API/MCP callFrom 5 credits
Need more credits?View pricing

Also available with

Guides

What does this CSV formatter do?

CSV files exported from spreadsheets, databases and scripts are rarely consistent — some use commas, others semicolons or tabs; some pad fields with stray spaces; some mix quoted and unquoted values. This tool parses whatever you paste with a real CSV parser (not a naive comma split) and re-serializes it into clean, consistently delimited, correctly quoted CSV.

RFC 4180 quoting, briefly

The RFC 4180 convention most spreadsheet and database tools follow says:

  • A field only needs quoting if it contains the delimiter, a double quote, or a line break.
  • A literal double quote inside a quoted field is escaped by doubling it ("").
  • Everything else can be written unquoted.

This tool's parser understands that convention on the way in — a quoted field like "Smith, John" is read as one field containing a comma, not two fields — and its serializer applies it on the way out, so quoting is added only where it's actually required.

Options

  • Input delimiter — comma, semicolon, tab, or Auto-detect (picks whichever delimiter appears most often, outside quotes, on the first line).
  • Output delimiter — comma, semicolon, or tab, independent of the input delimiter.
  • Quote styleQuote only when needed (RFC 4180 minimal quoting) or Always quote fields (wraps every field in double quotes, useful for tools that mis-parse unquoted numeric-looking strings).
  • Trim whitespace — strips leading/trailing spaces from every field, useful for CSV that was hand-edited or copy-pasted from a table.

How to use it

  1. Paste your CSV data into the input box.
  2. Pick the input delimiter, or leave it on Auto-detect.
  3. Choose an output delimiter and quote style.
  4. Copy the formatted result or download it as a .csv file.

FAQ

Does it handle quoted fields with commas inside them correctly? Yes. "Smith, John",30 parses as two fields — Smith, John and 30 — not three, because the parser tracks whether it's inside a quoted field before it looks for delimiters.

Can I convert a semicolon-delimited CSV to comma-delimited? Yes — set the input delimiter to semicolon (or Auto-detect) and the output delimiter to comma.

Will it fix an uneven number of columns per row? No — this tool re-delimits and re-quotes; it doesn't reshape rows. It won't silently drop or invent columns.

Privacy

Parsing and formatting run entirely in your browser. Your CSV data never leaves your device — safe for spreadsheets containing customer data, financial records, or anything else you'd rather not upload to a server.

csvformatterdataspreadsheetrfc4180

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.