Map Extract
Free tool

Swap the rows and columns of a CSV

Paste a CSV and get it back turned on its side, so whatever ran across the top now runs down the left, and each record that was a column becomes a row. Useful when a report arrives in the wrong orientation for the chart, import or comparison you need.

Runs in your browser. Nothing you enter is uploaded.

A campaign summary turned for a spreadsheet

Weekly reports are often written with one row per measure and one column per town. That is easy to read, but most spreadsheet charts, filters and imports want one row per town instead.

Transposing three rows of four columns gives four rows of three columns. The town names that ran across the top now run down the first column, and leads and replies become column headers, ready to sort by replies or add a reply rate column.

Input
town,Frome,Bath,Wells
leads,42,57,18
replies,5,9,2
Result
town,leads,replies
Frome,42,5
Bath,57,9
Wells,18,2

3 rows × 4 columns became 4 rows × 3 columns

Transposing a CSV

  1. Paste the data

    Paste straight from a spreadsheet or a text file. A header row is not required; every row is treated the same way.

  2. Check the separator

    Detect works for most data. Choose comma, semicolon, tab or pipe if the columns look wrong.

  3. Read the shape note

    The note under the output confirms the change, for example 3 rows × 4 columns became 4 rows × 3 columns.

  4. Copy or download

    Copy the transposed CSV or save it as transposed.csv.

Wide versus tall data

Data laid out with one record per column is called wide; one record per row is tall. People tend to write summaries wide because it fits on a slide. Software nearly always expects tall data: each row a business, a town or a week, each column a field. When an export or a copied table arrives wide, transposing is usually the quickest fix.

It works the other way too. A short list of a few businesses with many fields each is easier to compare side by side when each business is a column. Transpose, paste the result into a document or a Markdown table, and read across.

  • Quoted values containing commas stay intact.
  • Transposing twice returns your original layout, apart from any padding added to short rows.
  • Very wide results, with hundreds of columns, may be hard to open in some tools, so check the destination's column limit.

Questions people ask

How do I transpose a CSV file?

Paste the CSV into the box and the transposed version appears in the output straight away, with a note of the old and new shape. Copy it or download it as a new CSV. The first row of your data becomes the first column of the result, so headers end up running down the left-hand side.

Does transposing keep the header row?

Every row, including the header, is moved the same way. The header row becomes the first column, so its labels sit down the left side of the result. If your original first column held labels, as in most summaries, those become the new header row after transposing.

What happens if rows have different lengths?

The result is padded with empty cells so every new row has the same length. Values never move into the wrong column, but you may see trailing commas where short rows had nothing. Check the original for missing values if the padding looks unexpected.

Is this the same as Excel's paste special transpose?

It does the same thing to the data: rows become columns and columns become rows. The difference is that it works on the CSV text directly, so formatting, leading zeros and long numbers are not altered, and you can use it without opening a spreadsheet at all.

Where your data goes

The swap is done by your browser on the text in the box. Your data is not uploaded and the download is created on your own device.

Checked against the tool on

Top