Productivity and Utilities

CSV to Fixed Width Converter

Paste a CSV and set the width of each column, or let each width fit its longest value.

Paste the CSV. Up to 1,000,000 characters. Nothing is uploaded.

Such as 5, 20, 10. Leave a column off the list and it fits its longest value.

Every record gets the same length, so a program can find each field by its position. A column with no width fits its longest value, and a cell longer than its width is cut at the right and counted in the layout table, so check that count. Left alignment pads on the right, right alignment pads on the left, and Numbers right applies that only to cells that are plain numbers. Zero fill replaces the padding of right-aligned numbers with zeros and keeps a minus sign in front. Widths count characters, so very wide characters such as emoji may not line up in a monospace font, and many legacy systems count bytes instead. Nothing is uploaded from this page.

Next step

How to use the csv to fixed width converter

  1. Paste your CSV and choose the separator.
  2. Type the width of each column, such as 4, 14, 10. Leave a column off the list and it is sized to its longest value.
  3. Choose the alignment, the gap between columns and whether to fill numbers with zeros.
  4. Check the layout table for cells that were cut short, then copy the text or download it.

Formula

Left: cell + spaces to the width. Right: spaces to the width + cell

Zero fill on a right-aligned number: zeros between the sign and the digits

A cell longer than its width is cut at the right and counted

Widths count characters, not bytes. Wide characters may not line up in a monospace font.

Three people and an amount

With the widths 4, 14 and 10, Numbers right and one space between columns, every record is 30 characters long. The header record reads id, name and amount, each padded to its width. The first person is written as three spaces and a 1, then Ana Lopes padded to 14 characters, then 1250.50 on the right of a 10 character field. The layout table shows id at position 1 with width 4, name at position 6 with width 14 and amount at position 21 with width 10, and no cells cut short.

Choosing No gap and Fill numbers with zeros makes the records 28 characters long and writes the ids as 0001, 0002 and 0003, the first amount as 0001250.50 and the second amount, -80, as -000000080. If the name column is narrowed to 8 characters, Ana Lopes becomes Ana Lope and Carla Mendes becomes Carla Me, and the layout table counts two cells cut short.

When fixed width is still used

Many banks, mainframes, payroll providers and government systems read files where every field sits at a set position. There are no separators, so a program finds the amount by reading characters 15 to 24. The format is simple to read with a small program, and it is strict: one field too wide shifts everything after it. That is why the layout table shows where each field starts, how wide it is and whether any value was cut.

Zero fill and right alignment are the usual choices for numbers, and left alignment with spaces is the usual choice for text. The Numbers right option applies the right alignment only to cells that are plain numbers.

Checking the file before you send it

Compare the record length in the stats with the length your receiver expects. If a value was cut short, make the column wider or shorten the data, because silently cutting a name or an account number is the usual cause of failed imports. Quote marks are removed when the CSV is read, so they do not take up space in the fixed file.

To read a fixed width file back into columns, use the Fixed Width to CSV Converter. If a field in your file is a packed decimal, see the Packed Decimal (COMP-3) Converter. To change the separator of the CSV first, use the Change CSV Delimiter tool, and to check the CSV, the CSV Validator. The CSV JSON Converter changes the same data into JSON.

Assumptions and limits

  • The first row can be written as a header record, or left out by unticking Write the first row.
  • Columns that are missing from a short row are written as spaces.
  • The file is plain text with a line feed after each record and no trailing separator.
  • The sample people are made up.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

What happens if a value is too long?

It is cut at the right to fit and counted in the layout table, so you can widen the column.

How do I write a negative number with zero fill?

The minus sign stays first and the zeros come after it, so -80 in a field of 10 becomes -000000080.

Can I leave a gap between columns?

Yes. Choose one or two spaces. A true fixed width file normally has no gap, so use that for a receiver that expects exact positions.

Does it handle quoted cells with commas?

Yes. The CSV is read with the usual quoting rules before the fields are placed.