CSV Columns to Rows Converter
Transpose CSV data instantly - convert columns to rows and rows to columns. Handles quoted fields, custom delimiters, and large files. Free online tool.
About
Transposing a CSV matrix is the act of swapping its row index i with its column index j, producing a new matrix where element M[i][j] becomes MT[j][i]. This sounds trivial until your data contains commas inside quoted fields, escaped double-quotes, or ragged rows with inconsistent column counts. A naive split-by-comma approach will corrupt quoted fields containing delimiters, producing silently wrong output. This tool implements a full RFC 4180-compliant parser that handles every edge case before performing the transpose.
The tool accepts any delimiter (comma, semicolon, tab, pipe) and correctly processes fields wrapped in double quotes, including fields containing newline characters. Ragged rows (rows with fewer columns than others) are padded with empty values during transposition. Limitation: this operates entirely in-browser memory, so files exceeding approximately 50 MB may cause slowdowns depending on device RAM. For structured database exports, verify that your quoting rules match RFC 4180 before relying on the output.
Formulas
The transpose operation converts a matrix of m rows and n columns into a matrix of n rows and m columns:
Where M is the original parsed CSV matrix, m = number of rows (records), n = maximum number of columns across all rows, i = row index, and j = column index. For ragged matrices where row lengths differ, the effective column count is: n = max(len(rowi)) for all i. Cells beyond a short row's length are treated as empty strings.
The CSV parser uses a finite state machine with three states: FIELD_START, UNQUOTED, and QUOTED. Transition rules: encountering a quote character at FIELD_START enters QUOTED mode. Inside QUOTED, a double-quote ("") is an escaped literal quote. A lone quote exits to UNQUOTED. Delimiter or newline in UNQUOTED commits the field. This guarantees correct parsing per RFC 4180.
Reference Data
| Delimiter | Common Name | Character | Typical File Extension | RFC/Standard | Common Use Case |
|---|---|---|---|---|---|
| Comma | CSV | , | .csv | RFC 4180 | Spreadsheet exports, database dumps |
| Tab | TSV | \t | .tsv, .txt | IANA TSV | Bioinformatics, Unix tools |
| Semicolon | SCSV | ; | .csv | European locale CSV | Excel (EU locale), SAP exports |
| Pipe | PSV | | | .txt, .dat | HL7, EDI | Healthcare data, financial feeds |
| Colon | - | : | .txt | /etc/passwd | Unix system files |
| Space | SSV | ␣ | .txt | - | Fixed-width legacy data |
| Tilde | - | ~ | .txt | - | Custom enterprise exports |
| Caret | - | ^ | .txt | - | Mainframe data interchange |
| Double Quote | Quote Escape | "" | - | RFC 4180 ยง2.7 | Escaping quotes inside quoted fields |
| CRLF | Row Separator | \r\n | - | RFC 4180 ยง2.1 | Standard CSV row break |
| LF | Row Separator | \n | - | Unix convention | Linux/macOS CSV files |
| BOM | Byte Order Mark | U+FEFF | - | Unicode | UTF-8 BOM prefix from Excel |
| NULL | Empty field | "" | - | RFC 4180 ยง2.6 | Represents missing data |
| Newline in field | Embedded LF | \n inside quotes | - | RFC 4180 ยง2.6 | Multi-line addresses, descriptions |