CSV to Fixed-Width

Convert CSV data to a fixed-width text format.

About CSV to Fixed-Width

Fixed-width text is still the lingua franca of mainframes, bank file formats, printed reports and plain-text emails: every column starts at the same character position, so the data lines up without a spreadsheet. This tool measures the longest value in each CSV column, pads every cell with spaces to that width and writes a .txt file where the columns are perfectly aligned.

Paste the CSV, choose how many extra spaces to leave between columns and download the text file. Everything is computed in the browser, so the content of the file never leaves your computer.

How to use CSV to Fixed-Width step by step

  1. Type the name of the output file; the .txt extension is added automatically.
  2. Set "Column padding", the number of extra spaces added after each column (2 by default).
  3. Paste the comma-separated CSV into the text area.
  4. Click "Convert and download". The file contains the header, a line of dashes and the padded rows.

Input and output example

Input

name,surname,city
Juan,Pérez,Madrid
Ana,García,Barcelona

Output

name  surname  city       
---------------------------
Juan  Pérez    Madrid     
Ana   García   Barcelona  

Why use our CSV to Fixed-Width?

Common use cases

Limits and tips

Frequently asked questions

What is a fixed-width file?

A fixed-width (or positional) file is plain text where each column occupies a fixed number of characters, padded with spaces, instead of being separated by a delimiter. Column boundaries are defined by character positions, for example characters 1-10 for the name and 11-20 for the surname.

What is the difference between CSV and fixed-width?

CSV separates values with a delimiter and each row can have a different length, which makes it compact and easy to parse. Fixed-width pads every value to a set width, so the file is larger but human-readable without tools and compatible with legacy systems that read fields by position.

Can I choose each column width manually?

No. Widths are derived automatically from the longest value in each column plus the padding you set. If a system requires exact widths, add a dummy first row with values of the required length or adjust the file afterwards.

How do I convert back from fixed-width to CSV?

Use the Fixed-Width to CSV tool: paste the text, enter the width of each column separated by commas and download the CSV. The widths equal the longest value per column plus the padding used here.

Does it upload my file?

No. The padding and alignment are computed in your browser with JavaScript and the .txt file is created locally.

Related tools

Other free utilities you may find useful

Available languages