CSV transposer — swap rows and columns in a CSV file

Paste a table or choose a CSV or Excel file and the transposer turns it on its side, so the first row becomes the first column, the second row the second column, and so on, with empty cells added where rows were short.

Live demo · real result from this tool

Drop your file here

or paste with Ctrl+V · nothing is uploaded

Or paste CSV / TSV in the box below. Excel files (.xlsx) use their first sheet.

Loading the tool…

Processed on your device — nothing is uploaded.

How to use the CSV transposer

  1. Press Choose a file to load a CSV, TSV, text or Excel file, or paste your table into CSV data.
  2. Leave Delimiter on Detect automatically, or choose comma, semicolon, tab or pipe if the guess is wrong.
  3. The result appears at once. Check the Rows × columns line and the preview table.
  4. Copy the Transposed CSV or press Download to save <name>-transposed.csv.

What it does and when to use it

Transposing turns a wide table into a long one, or the reverse. A monthly report with metrics down the side and months across the top is easy to read, but a chart or database usually needs months down the side and one column per metric. A survey export with one column per respondent may need one row per respondent instead.

After flipping, you can chart the result straight away with the line chart maker or the bar chart maker, whose data format is labels in the first column and one column per series. If the file has extra columns you do not need after the flip, the CSV column extractor can drop them.

How it works

The input is parsed with PapaParse, which understands quoted fields that contain commas or line breaks, and blank lines are skipped. The tool then:

  1. finds the longest row and pads shorter rows with empty cells;
  2. builds a new table where new row j is made from column j of every original row, so cell (row i, column j) moves to (row j, column i);
  3. writes the result with the same delimiter as the input, quoting only the fields that need it.

The stats line shows the shape before and after, for example 2 × 3 → 3 × 2. The preview uses the new first row as its heading. All of this happens in your browser; the file is not uploaded.

Worked examples

Monthly metrics (the sample). The input has three metrics as rows and three months as columns:

Metric,Jan,Feb,Mar
Visitors,1200,1350,1610
Sign-ups,84,97,120
Conversion %,7.0,7.2,7.5

The transposed file has one row per month:

Metric,Visitors,Sign-ups,Conversion %
Jan,1200,84,7.0
Feb,1350,97,7.2
Mar,1610,120,7.5

A short row. a,b,c above 1,2. The second row is padded to three cells first, so the result is a,1, b,2 and c, with an empty last value. The stats read Rows × columns: 2 × 3 → 3 × 2.

Limits and tips

  • Very wide results are hard to read in some programs; a file with 5,000 rows becomes 5,000 columns.
  • Spreadsheet files are read from their first sheet only, with cells as they are displayed.
  • To tidy stray spaces and blank columns before flipping, run the CSV cleaner first.

Frequently asked questions

When would I need to transpose a CSV?
When the data runs the wrong way for the next step. Reports often put months across the top, while charts, databases and import templates usually want one row per month. Transposing fixes that without retyping.
What happens with rows of different lengths?
Every row is first padded with empty cells to the length of the longest row. Without that, values would slide into the wrong columns after the flip.
Is there a header option?
No, because the header takes part in the flip. The first row becomes the first column, so your old column names end up down the left side and the old first column becomes the new header row.
Are numbers or dates changed?
No. Every value is copied as text, so 7.0 stays 7.0 and leading zeros are kept. Only the position of each cell changes.
Can I transpose twice to get the original back?
Yes, if the rows were all the same length. If short rows were padded, the second flip keeps the added empty cells.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close