Trim Whitespace in a CSV File
Remove leading and trailing whitespace around CSV cells while keeping the spaces inside values.
Workspace
Input data
or drop a CSV or TSV file here
Options
Excel cells are saved as text to keep every digit.
Cleanup options
Advanced options
Use column numbers starting at 1. Omitted columns are deleted.
Enter comma-separated names in output order. Leave positions blank to keep their names.
Preview
Your rows and columns will appear here.
Change report
How to use Trim CSV Whitespace
- Load the file and check that fields appear in separate columns.
- Leave Trim whitespace selected and check the cell count in the change report.
- Download the result. Enable Remove duplicate rows if trimming reveals repeated records.
Example
Name ,City,Code
Maya Chen , Boston ,02108
Leo Ortiz, Austin ,00501The formatter trims spaces around “Maya Chen” and “Boston”. The space between Maya and Chen stays.
Frequently asked questions
What is a CSV file in Excel?
A CSV is plain text Excel opens as rows and columns. Values can contain spaces or tabs at their edges even when those characters are hard to see in a cell. Trimming the CSV first can make comparisons and imports more consistent, especially in fields used as lookup keys.
What type of CSV to use?
Choose UTF-8 CSV for general cleanup, and use the separator the destination expects. Leave quoted fields intact so the parser can identify the true edges of each value. If the table appears in one column, select the source delimiter before applying whitespace cleanup.
What does Trim whitespace remove?
It removes spaces and other whitespace at the beginning and end of cells, including header labels. Spaces inside a name or description stay in place. Review the number of affected cells in the change report and compare important labels before downloading the cleaned file.
Does trimming remove leading zeros or spaces between words?
No. Trimming targets whitespace at the edges of a value. Digits such as the zeros in 00123 and the space inside a name such as Maya Chen stay. If you plan to open the result in a spreadsheet, use text column settings for identifiers.
Can two records become duplicates after trimming?
Yes. Rows that differ only by surrounding spaces can match once those spaces are removed. Enable duplication removal if you want the first such row to be kept. The cleanup takes place in your browser, and FormatMyCSV never uploads the source or generates a server copy.