Skip to content

Free · Browser-local tools

Transpose a CSV file

Swap CSV rows and columns, including the source header row. Preview the new layout, apply with undo, or download a transposed copy.

Transpose CSV

Start with your CSV

Open your file in the CSV editor with this tool already selected. Preview the result before downloading.

  1. Open your CSV.
  2. Review dimensions and paired before/after tables.
  3. Copy, apply with undo or download the transposed result.

Free · No signup · File contents stay in your browser. Open files up to 1 GiB with browser storage.

Try a small example

3 records · 3 columns
Illustrative CSV sample data
idnameamount
1Example one12
2Example two24
3Example three18

Rows become columns

Rows become columns
id123
nameExample oneExample twoExample three
amount122418

Illustrative fictional data. Open the sample to try the tool.

How to transpose csv

  1. 1

    Open your CSV.

  2. 2

    Review dimensions and paired before/after tables.

  3. 3

    Copy, apply with undo or download the transposed result.

What to expect

Transposes the complete rectangular table including the source header row. The first resulting row becomes the output headers.

Local files and clear limits

These tools process file contents on your device. The browser workspace accepts files up to 1 GiB and 5 million records, subject to available browser storage and decoded-record limits. This tool's calculations support up to 100,000 records, 2 million cells and 64 MB of text. Download a new copy to keep your result.

Plain answers

Transpose CSV questions

Does transpose include my CSV header?

Transposes the complete rectangular table including the source header row. The first resulting row becomes the output headers.

Does my CSV leave my device?

File selection, editing and these task operations run in your browser. Optional recipe assistance, when available, sends your goal and only the column metadata or sample values you explicitly include to its configured provider. Your file is not attached automatically; see Privacy for processing details. Manual editing requires no account or file upload. Download a new copy to keep your result; refreshing restores the original input, not unsaved edits.

Do the editor and task have the same file limits?

The editor opens files up to 1 GiB and 5 million records, subject to browser storage and decoded-record limits. This task supports up to 100,000 records, 2 million cells and 64 MB of decoded text.

Other ways to work with your CSV

Use these local examples when you prefer a script or SQL. They create separate results and explain where their behavior differs from this browser tool.

Transpose a CSV table with Python

Transposes the full rectangular table, including its header. The first source column becomes the new header row.

Before you start

  • Python 3.10 or later. Run in a working folder with a backup of your source; output files may be replaced unless opened in exclusive mode.
  • Place input.csv in that folder. Examples use UTF-8, a comma delimiter and a header row. Column-specific recipes use id,label,amount,status,note; adapt names to your file.
Run the complete Python example
python3 - <<'PY'
import csv

with open("input.csv", encoding="utf-8-sig", newline="") as source:
    table = list(csv.reader(source, strict=True))
if not table:
    raise ValueError("Expected a header row")
headers, rows = table[0], table[1:]
if any(len(row) != len(headers) for row in rows):
    raise ValueError("Every record must match the header width")

transposed = [list(column) for column in zip(headers, *rows)]
headers, rows = transposed[0], transposed[1:]

with open("output.csv", "w", encoding="utf-8", newline="") as target:
    writer = csv.writer(target)
    writer.writerow(headers)
    writer.writerows(rows)
print(f"Wrote {len(rows)} records to output.csv")
PY

Limits and output

  • CSV has no stored type schema. Python keeps fields as strings until an example explicitly converts a value. These recipes do not add spreadsheet formula protection; import sensitive-looking strings as text in spreadsheets.
  • The table is held in memory. Transposed headers can be blank or duplicated if the original first column contains those values.
  • This recipe retains the parsed table in memory; use a streaming approach for files that do not fit.

Documentation: Python CSV reader and writer