CSV Formatter

Clean up and reshape messy CSV data.

CSV Formatter tool

Cleaning
—

About the CSV Formatter

CSV files often fail to import because of small, invisible problems: trailing spaces, inconsistent quoting, an unexpected delimiter, blank rows at the end, a byte order mark at the start or line endings from another operating system. This CSV formatter fixes those problems in one pass, letting you switch between commas, semicolons and tabs, trim whitespace, remove empty and duplicate rows and quote fields properly so the file imports cleanly into databases, accounting software and spreadsheets. An aligned view makes columns easy to check by eye before you download the cleaned file. To inspect the data first, open it in the CSV Viewer, and to convert it for code, use CSV to JSON.

Every repair is its own option, so you can give the receiving system exactly what it expects and change nothing else. The separator can be switched between comma, semicolon, tab and the pipe character. Quoting can be kept to the minimum, where only fields that need quotes get them, or applied to every single field for strict importers that insist on it.

An alignment option adds spaces so that every column starts at the same position when the file is opened in Notepad or any other basic editor. That view is meant for people rather than for import software, and it is the fastest way to notice a row with one field too many or too few.

How to use the CSV Formatter

  1. Add your CSVPaste the text or open the file; the separator it uses is detected automatically.
  2. Choose the output formatPick the separator and the quoting style the destination system needs.
  3. Select the clean-up stepsTrim spaces, delete blank rows, remove duplicates and strip the byte order mark.
  4. Save the cleaned fileCopy it or download it, ready for import.

CSV Formatter features

  • Separators converted between comma, semicolon, tab and pipe
  • Minimal quoting or quotes around every field
  • Spaces trimmed from the start and end of fields
  • Blank rows and repeated rows removed
  • Byte order mark stripped from the start of the file
  • Line endings made consistent
  • Padded column view for reading in a text editor
  • Rows with an unexpected number of columns reported

Common uses

  • Turning a semicolon export into the comma format an importer wants
  • Removing stray spaces that make lookups and matches fail
  • Deleting the blank lines a spreadsheet left at the bottom
  • Repairing quotation marks damaged by hand editing
  • Finding the one row that has an extra column

Fixing CSV files in practice: supplier price lists, line endings, header names, long numbers and clean imports

By the FreeToolsWorld editorial team · Updated November 2026 · How we write and check our guides

Most failed CSV imports have nothing to do with the data itself. The values are right, but the file is shaped slightly differently from what the receiving system expects: the wrong separator, an invisible character at the start, Windows line endings, a header with a trailing space. This guide works through preparing a supplier's price list for an online store, explains each formatting problem in turn and shows how to protect long numbers and keep files tidy for the future.

A worked example: a supplier price list

A wholesaler sends a price list exported from an accounting system configured for a European region. The file uses semicolons as separators, starts with a byte order mark, uses Windows line endings and has two empty rows at the end. The online store's importer expects comma-separated UTF-8 with a header row exactly matching its field names.

The clean-up runs in a fixed order: convert the separator from semicolon to comma, remove the byte order mark, convert line endings, trim spaces from every field and delete the empty rows. After that, the importer accepts all 1,240 products on the first attempt, where before it failed on the very first line because it could not recognise the first column name.

Line endings

Windows marks the end of each line with two characters, a carriage return and a line feed, while Linux and macOS use only the line feed. Some importers treat the extra carriage return as part of the last field, so a price of 450 is read as 450 followed by an invisible character and rejected as not a number. Converting line endings to match the receiving system removes this hard-to-see problem.

Header names that almost match

Importers usually map columns by header name, so Price with a trailing space, price in lower case, or Unit Price where the system expects Price all cause columns to be skipped or the whole import to fail. Before importing, compare the headers with the system's template character by character. Trimming spaces from headers and matching the expected capitalisation fixes most mapping errors.

Quotes inside fields

When a field contains a double quote, CSV represents it by doubling the quote and wrapping the whole field in quotes, so a product named 24" Monitor is written as "24"" Monitor". Files edited by hand often break this rule, which shifts the rest of the row into the wrong columns. A formatter that re-writes quoting consistently repairs these rows, and checking the row with the wrong column count usually points straight to the culprit.

Choosing a separator

Commas are the default, but they clash with addresses and amounts written with thousands separators. Tab-separated files avoid that clash and paste neatly into separate spreadsheet columns, which makes them handy for quick copying. A pipe character is a good choice for data full of commas and semicolons, such as addresses and product descriptions, as long as the receiving system accepts it.

Long numbers and spreadsheets

Spreadsheet programs keep only 15 significant digits for numbers. A 13-digit CNIC written without hyphens survives but may be displayed in scientific notation, while 16-digit and longer identifiers, such as some account or tracking numbers, have their final digits replaced with zeros as soon as the file is saved. Once saved, the original digits are gone. Keeping such columns as text, or editing the file in a text-aware tool instead of a spreadsheet, protects them.

Strict import formats

Banking, payroll and enterprise systems often demand an exact format: every field quoted, a specific date format, a fixed column order and sometimes no header row at all. Their documentation usually includes a sample file. Formatting your file to match that sample exactly, then comparing the first few lines side by side, saves several rounds of rejected uploads.

Consistent files in version control

When CSV files are stored in a code repository, inconsistent quoting and line endings make every change look like a rewrite of the whole file. Formatting files the same way every time, with the same separator, quoting rule and line endings, keeps differences small so reviewers see only the rows that actually changed.

Common mistakes

  • Opening a file in a spreadsheet and saving it again, which silently changes numbers and dates.
  • Ignoring Windows line endings when importing on Linux servers.
  • Leaving trailing spaces in header names.
  • Editing quoted fields by hand and breaking the doubling of quotes.

Related tools

To inspect the result as a table, use CSV Viewer. To convert rows into objects for code, try CSV to JSON Converter, and to remove stray spaces and invisible characters from text, Text Cleaner.

Empty columns at the end of rows

Some exports add blank columns to every row, which appear as a string of separators at the end of each line. Strict importers count these as extra fields and reject the file for having the wrong number of columns. Removing the empty trailing fields, so every row has exactly the number of columns in the header, clears this error without touching the real data.

Privacy

Formatting runs in your browser. Price lists, customer data and other files are not uploaded or stored.

Frequently asked questions

Why is my CSV separated by semicolons?

Spreadsheet programs in countries that write decimals with a comma export semicolon-separated files instead. An importer expecting commas then reads each line as a single column, and switching the separator here solves it.

What is a byte order mark, and why remove it?

It is an invisible code some programs put at the very beginning of a UTF-8 file. Most software ignores it, but some importers treat it as part of the first column name, which is why a header that looks perfect can still refuse to match.

What does minimal quoting do?

It puts quotes only around fields that contain the separator, a quotation mark or a line break. The result is smaller and easier to read. Strict parsers that want every field quoted can use the other setting instead.

Will aligned columns cause problems on import?

The padding adds spaces inside fields, so the file is still valid but its values change. Use aligned mode for reading and checking, not for files you plan to import; the tool reminds you while it is switched on.

What happens to rows with too many or too few fields?

They are listed with their line numbers instead of being changed silently, because only you can tell whether a short row should be padded out or whether it points to a broken export.

Is my file sent to a server?

No. All the cleaning happens in your browser, so customer lists, financial exports and other sensitive spreadsheets stay on your own device and are never stored online.