CSV Pivot and Unpivot Tool
CSV pivot groups your rows by one column and aggregates a value, and unpivot turns wide columns into long field and value rows.
Comma-delimited UTF-8 CSV only; up to 100,000 characters, 1,000 records including header and 100 columns. Output is bounded to 10,000 cells and 100 columns.
Files and pasted text are read in this page; nothing is uploaded and no account is needed. This page also loads analytics scripts, so avoid confidential text.
Preview
Output preserves parsed cell text, not original quoting, BOM or record separators. Ragged explicit rows and malformed quotes stop export before a grid is built. See RFC 4180 format guidance.
CSV export preserves cell text; it does not make formula-like cells safe for spreadsheet software. Review cells before opening in a spreadsheet. OWASP CSV Injection guidance.
Next: select and reorder CSV columns before reshaping, remove duplicate CSV records before aggregating, or convert the result to JSON.
Why pivot or unpivot a CSV file?
Two shapes, one file
Pivot and unpivot answer opposite needs. A long export of daily records becomes a compact grid, and a wide month per column report becomes one record per month.
Aggregation you can check
Count, sum, average, min and max are named for each cell, and the result reports records in, rows and columns out, and any value left empty, so a surprising total can be traced back to the rows that made it.
No spreadsheet needed
Open a CSV, choose the fields, read the grid and download it. Nothing is installed and no workbook has to be built first.
How CSV pivot and unpivot work
A long table usually stores one observation per record: a region, a month and a number. A pivot chooses a grouping column, a spread column and a value, then writes one output row per distinct group, one output column per distinct spread value, and one aggregate in each cell. Repeated key pairs are the normal case in this shape, so they are aggregated rather than rejected as duplicates.
An unpivot goes the other way. Wide columns such as Jan, Feb and Mar become rows in a single value column, and each column name is written into a field column. Unpivot keeps every value in the columns it includes. Pivot does not, because summing two records into one cell throws away the difference between them, which is why the page never promises a round trip. Five records can go in and two come out, and the original Jan 2 and Jan 3 values are gone.
Aggregation, missing values and limits
- Count valuesCounts the non-blank values in each cell group. A group that exists but holds only blanks shows 0, while a group with no record at all stays empty, and those are different facts.
- Sum, average, min and maxRead a blank value as missing and skip it. A non-numeric value stops the run with the record number and the column, instead of being counted as zero or skipped without a word.
- Number formattingIntegers print unchanged and other values print to twelve significant digits, so 0.1 plus 0.2 shows 0.3. A total outside the exact integer range stops the run rather than printing an approximate number.
- Key orderOutput rows and columns keep the order their keys first appear in the source. Nothing is sorted, so a grid can be read next to the file it came from.
- Header namesColumn names come from the first record. A blank name or a repeated name is labelled with its position, so two id columns stay separate.
- DelimiterInput and output are comma-delimited CSV with quoted fields. A semicolon or tab separated file has to be converted first, and the page never guesses a delimiter.
- LimitsAt most 1,000 records, 100 columns and 100,000 characters in, and at most 10,000 cells and 100 columns out. Each limit is checked before the grid is built.
Common Use Cases
Monthly report to grid
Turn records of region, month and hours into a grid a manager can read at a glance, with a total in each cell.
Grid to chart data
Flatten a wide quarterly table into long rows that a chart or a database import expects.
Find repeated pairs
Pivot on an identifier and a date with count to see which pairs appear more than once before cleaning the file.
How to pivot or unpivot CSV
Add the CSV
Paste comma-separated rows or open a UTF-8 file, with the first record holding the column names.
Choose the mode
Pivot for a summary grid, or unpivot to turn wide columns into long rows.
Map the fields
Pick the grouping column, spread column and value, or pick the columns to keep.
Review the grid
Check the group counts and the output dimensions, then copy or download the current CSV.
Counts, decimals and bounds
Readable decimals
Sums and averages print to twelve significant digits, so a floating point tail never lands in your spreadsheet.
Missing values visible
Count and the numeric aggregations treat a blank cell differently, and that rule is printed with the result instead of applied silently.
Bounded output
The tool refuses a grid larger than 10,000 cells before building it, so a wide pivot cannot freeze the tab.
Before you replace the source file
- •Pivot is not transpose: Transpose swaps rows and columns without combining anything. Pivot combines records that share a key.
- •Keep the source: An aggregated grid cannot be turned back into the original records. Keep the input file before you replace it.
- •Check the total: Compare a sum with the source column, especially when a value was not numeric and stopped the run.
Reshape the CSV you have
Add the CSV above and choose pivot or unpivot.
Map the fields, check the grid and the counts, then copy or download the current result.
Related tools
CSV Column Extractor
Export chosen CSV fields in chosen order without dropping parsed records.
CSV Duplicate Remover
Deduplicate parsed CSV records while keeping complete selected survivors.
CSV to JSON Converter
Move data between CSV and JSON formats.
CSV to HTML Table
Generate a safe HTML table from CSV data.
Frequently Asked Questions
What is the difference between pivot and unpivot?
Pivot groups records that share a key and puts an aggregate in each cell. Unpivot turns wide columns into long field and value rows, keeping one row per cell value.
Is pivot the same as transpose?
No. Transpose swaps rows and columns as they are. Pivot combines several records into one cell, so information is summarised and cannot be recovered by transposing back.
How are empty and non-numeric values handled?
Count values counts non-blank values, so a group with only blanks shows 0. Sum, average, min and max skip blanks, and a non-numeric value stops the run and names the record and column.
Which delimiters are supported?
Comma-delimited CSV in both directions. A file with semicolons or tabs needs converting first, because the tool never guesses a delimiter.
Can I group by two columns?
Not in this version. One grouping column, and you can join two fields into one column in the source first if you need a combined key.