ForHosting KIT · Text & AI

Transpose CSV rows and columns

name,age,city over Ada,36,London and Bob,41,Paris flips into name,Ada,Bob, then age,36,41, then city,London,Paris: every row becomes a column. Short rows are padded with empty cells and quoted commas stay intact. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
CSV data
name,age,city Ada,36,London Bob,41,Paris
You get
CSV data
name,Ada,Bob age,36,41 city,London,Paris
Rows
3
Cols
3
Original rows
3

Transposing a CSV table means every row becomes a column and every column becomes a row, so a wide export turns tall and a tall export turns wide without rewriting cells by hand. Analysts use that flip when a spreadsheet arrived with metrics as rows instead of columns, when a charting tool wants series down the first column, or when a pivot-style layout must be undone before a join. This capability parses RFC 4180-style CSV, pads short rows so the grid is rectangular, swaps indices, and writes the transposed table back with the same delimiter and correct quoting.

What transposing CSV rows and columns means

A CSV file is a rectangular-ish grid: records separated by line breaks and fields separated by a delimiter, most often a comma. Transposing that grid is the same shape swap people know from linear algebra, applied to text cells rather than numbers. The first input row becomes the first output column; the first input column becomes the first output row.

A three-by-two table becomes two-by-three. Headers are not special: if the first row is name, age, city, those labels move into the first column of the result, which is exactly what most “flip this spreadsheet” searches want. The definition only works once every row shares a column count.

Real exports are often jagged—one line missing a trailing empty field, another carrying an extra comma—so this tool pads short rows with empty strings up to the widest row instead of inventing data or dropping cells. Quoted fields follow RFC 4180: a cell that contains the delimiter, a double quote, or a line break stays one cell, and an embedded quote is written as two quotes. Prefer this transpose-csv-rows-and-columns landing when the intent is a pure orientation flip.

What to paste and what you get back

Optional delimiter defaults to comma; use a single character or the common tab spelling for TSV. A field is quoted on the way out only when it contains the delimiter, a quote, CR, or LF, so simple identifiers stay compact. Blank lines in the source are skipped; empty cells are kept, including a leading empty cell after the flip.

Example: name,age then Ada,36 becomes name,Ada on the first result row and age,36 on the second. Use csv when you need a file to download or paste; use cells when a client will render a table without parsing again.

Flip a wide monthly export

Paste a spreadsheet where each month is a column, transpose so each month is a row, and feed the tall table into a chart or join.

Fix a sideways survey dump

Survey tools sometimes emit one respondent per column. Transpose the CSV so each person is a row before analysis.

How do I transpose CSV rows and columns?

The response csv field is the flipped table; cells is the same grid as arrays. Optional delimiter defaults to comma.

What happens to the header row?

The first row becomes the first column. Labels such as name, age, and city move into the first output column, which is the usual spreadsheet flip.

How are uneven rows handled?

Short rows are padded with empty strings up to the widest row so the transpose stays rectangular. No cells are dropped and no values are invented beyond those empties.

Does it keep commas inside quoted fields?

Yes. Parsing and writing follow RFC 4180: quoted fields may contain the delimiter, quotes (doubled), and line breaks.

Is the transpose CSV tool free?

The browser tool runs free on your device.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/str/csv-transpose

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/str/csv-transpose \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"csv":"name,age,city\nAda,36,London\nBob,41,Paris"}'
{
  "csv": "name,age,city\nAda,36,London\nBob,41,Paris"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "str.csv_transpose",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Empty input, unclosed quotes, and oversized tables fail with invalid_input instead of a silent half-grid. Successful API calls are billed at $0.002; validation failures are not charged.

What transposing CSV rows and columns means

Do not use it to filter rows, rename many columns, join two files, or convert an entire table to nested JSON—those are separate product intents. The path is fully deterministic: identical CSV text and delimiter always produce identical JSON with no network, no random seed, and no wall clock.

Input contract, quoting rules, and response fields

Send a JSON body with required string field csv set to the non-empty table text. Aliases text, input, data, source, content, and value are accepted for the CSV body. Missing csv, empty csv, non-string csv, a delimiter that is not exactly one character, a delimiter that is a quote or newline, unclosed quoted fields, and tables that exceed the documented size limits all raise invalid_input with a message that names the problem, and those failures are not charged on the prepaid API. On success the response includes csv as the transposed table text with LF row separators and RFC 4180 quoting, cells as the same grid in array form, rows and cols for the result shape, original_rows and original_cols for the input shape (original_cols is the maximum width before padding), delimiter echoing the separator used, and method always csv_transpose.

API usage, pricing, workflows, and practical limits

Call the free in-browser transpose CSV tool when you need to flip a homework table, a CRM export, or a metrics dump without opening a spreadsheet or writing a one-off script. A typical workflow pastes a wide month-across-the-top export, transposes so each month is a row, then feeds the result into a chart or a join. Do not expect automatic delimiter detection, type inference, or a full pivot-table engine with aggregations—those are different problems. Authors shipping SDKs can document csv as required, show a success example with a named header row, and show a missing-csv error example so integrators see both sides of the contract. Use the prepaid KIT API when a CMS, ETL step, QA harness, tutoring app, or mobile client needs the same contract under balance at $0.002 per successful item; validation failures never consume balance after the engine rejects the request. Pair this endpoint with extract-csv-column, filter-csv, or csv-to-json when the next step is a single field list, a row filter, or an object array, but keep transpose CSV as its own landing so the orientation-flip intent is not mixed with transforms that rename or compute columns. Keep payloads within ordinary document sizes suitable for a Worker isolate rather than multi-megabyte warehouse dumps.

Golden fixtures for CSV parsers

CI scripts pin a quoted, jagged sample and assert the transposed csv and cells so quoting and padding cannot regress silently.

Read the full KIT documentation →