How to use the csv transpose
- Paste your CSV into the input area.
- Choose the delimiter (comma, semicolon, tab, pipe, or custom).
- Toggle “First row is header” if your CSV starts with column names.
- Copy the transposed CSV from the output area or download it.
How the csv transpose works
The tool parses the input into a rectangular matrix of cells. If First row is header is on, the first row is removed and stored as headers. Every row (including the header row if present) is padded to the width of the widest row with empty strings. The matrix is then transposed: the cell at row r, column c moves to row c, column r. If headers were present, they become the first column of the output and a new header row Row 1, Row 2, … is inserted at the top. The resulting matrix is serialized back to CSV using the same delimiter and RFC 4180 quoting rules.
Worked example: input A,B\n1,2 with header on. Parsed matrix (header removed): [[1,2]]. Headers: [A,B]. Pad to width 2 (already). Transpose data: [[1],[2]]. Prepend headers as first column: [[A,1],[B,2]]. Add new header row: [,Row 1]. Final CSV: ,Row 1\nA,1\nB,2.
RFC 4180 parsing details
The parser implements the RFC 4180 specification:
- Fields are separated by the chosen delimiter (default comma).
- A field may be wrapped in double quotes. Quoted fields may contain the delimiter, newlines (CRLF or LF), and double quotes.
- Inside a quoted field, a double quote is escaped by doubling it:
""represents a single". - Lines end with CRLF (
\r\n) or LF (\n). A trailing newline after the last record is ignored. - Unquoted fields cannot contain the delimiter, double quotes, or newlines.
The serializer applies the same rules: any field that contains the delimiter, a double quote, or a newline is wrapped in double quotes and internal double quotes are doubled.
Ragged rows and padding
CSV files often have rows with different column counts. This tool reports the raggedness honestly: it finds the maximum column count across all rows, pads shorter rows with empty strings, and transposes the padded matrix. The output will therefore be rectangular. A note in the result area tells you how many rows were padded and to what width.
Example: input a,b\nc,d,e\nf (three rows, max 3 columns). Padded matrix: [a,b,""], [c,d,e], [f,"",""]. Transposed: [a,c,f], [b,d,""], ["",e,""]. Output CSV (no header): a,c,f\nb,d,\n,e,.
Common use cases
- Data reshaping: turn a wide table (many columns, few rows) into a long table for charting libraries that expect series in rows.
- Header normalization: when a CSV has column names in the first row, transposing with the header option makes each original column a row with its name as the first cell.
- Delimiter conversion: parse with one delimiter, transpose, and copy the result: the output uses the same delimiter, so you can also use this as a quick delimiter-normalizer.
- Debugging imports: transpose a problematic CSV to see whether columns align as expected.
Limits and performance
The parser and transposer run in the main thread. They handle tens of thousands of rows comfortably. Very large inputs (megabytes of text) may cause noticeable UI lag; for such files, consider a streaming tool or script. All processing stays in your browser: no data is sent to any server.
Worked examples
| Example | Input | Result |
|---|---|---|
| Simple 3×3 | CSV input: A,B,C / 1,2,3 / 4,5,6; Delimiter: ,; First row is header: yes | Original rows: 3; Original columns (max): 3; Transposed rows: 4; Transposed columns: 4 |
| Quoted fields with commas | CSV input: "Name","Description" / "Alice","Likes apples, oranges" / "Bob","Prefers bananas"; Delimiter: ,; First row is header: yes | Original rows: 3; Original columns (max): 2; Transposed rows: 3; Transposed columns: 3 |
| Semicolon delimiter, no header | CSV input: 1;2;3 / 4;5;6; Delimiter: ;; First row is header: no | Original rows: 2; Original columns (max): 3; Transposed rows: 3; Transposed columns: 2 |
| Ragged rows (padded) | CSV input: a,b / c,d,e / f; Delimiter: ,; First row is header: no | Original rows: 3; Original columns (max): 3; Transposed rows: 3; Transposed columns: 3; Rows padded: 2 |
FAQ
Does the tool modify my data?
No. It only rearranges rows and columns. Cell contents are preserved exactly, including whitespace and case.
What happens if I choose a custom delimiter longer than one character?
Only the first character is used. The rest are ignored.
Can I transpose TSV (tab-separated values)?
Yes. Choose “Tab (\t)” from the delimiter dropdown.
Why does the output have an extra empty cell at the top-left when I use the header option?
That cell corresponds to the intersection of the new header row (Row 1, Row 2, etc.) and the new first column (the original headers). It is intentionally left blank.
Is there a size limit?
No hard limit, but the browser's memory and main-thread responsiveness constrain practical size to a few megabytes.
Can I download the result as a file?
The output area is a standard textarea; use your browser's “Save as...” on the copied text, or copy and paste into your editor.
How does the csv transpose handle quoted fields with embedded delimiters?
The RFC 4180 parser keeps quoted fields intact, so embedded delimiters and newlines do not split the field.