Data Sampler
Cut a long CSV or list down to a readable number of rows, without losing their original order.
What this tool does
Data Sampler reduces a pasted table to a manageable slice. Four modes decide which rows survive: the first N, the last N, N drawn at random, or every Nth row for an even spread from the top of the file to the bottom. Whichever you pick, the rows come out in the order they went in, and a CSV header row is lifted off before sampling and put back on top of the result afterwards.
Random mode uses reservoir sampling, so every data row carries exactly the same chance of being kept regardless of where it sits in the file, no row can be drawn twice, and the selection is made in one pass rather than by shuffling a copy of everything. Leave the seed box empty and each run gives a different draw; type any word into it and the same input returns the same rows every time, which is what makes a sampled test fixture worth committing to a repository.
A few limits are worth knowing before you paste a real file. Everything runs in this browser tab and nothing is transmitted, but this is a text box rather than a file picker, so the input arrives through the clipboard and the whole of it has to fit in the tab's memory — a few megabytes of CSV is comfortable, a multi-gigabyte export is the wrong job for it. In CSV mode the output is also written out fresh rather than copied line for line, which normalises quoting, separates records with CRLF and pads short rows to the width of the widest row. Sampling is uniform over rows only: there is no grouping by column value, so a stratified sample that keeps a fixed share of each category has to be built somewhere else.
How to use it
- Paste the data. The rows go straight into the input box; Load sample fills it with a small CSV if you want to see the expected shape first.
- Say what the input is. CSV rows parses quoting and can detect the delimiter for you. Plain lines treats every line as one opaque record and leaves it alone.
- Choose how to sample. First rows, Last rows, Random rows or Every Nth row. Every Nth begins at the first data row and steps through to the end of the file.
- Set the size. A number of rows, or a percentage of them, for the first three modes. Ask for more rows than the file holds and you get the whole file back.
- Deal with the header and delimiters. First row is a header keeps that line out of the draw and back on top of the output; the box belongs to CSV rows only, so under Plain lines the first line is sampled like any other. The output delimiter can differ from the input one.
Processing & privacy
Runs on your device. Your file is processed directly in this browser.
Common use cases
Previewing an unfamiliar export
Take the first hundred rows to see the columns and the shape of the values before writing an import script against the full file.
Building a repeatable test fixture
Sample rows at random with a seed, so the fixture stays small, spreads across the whole file, and comes out identical when somebody regenerates it.
Reading the end of a long export
Last rows shows the most recent entries without scrolling through a hundred thousand lines to reach the bottom of them.
Thinning a time-ordered series
Every Nth row keeps the spread of a whole year while cutting the row count down to something a quick chart or a sanity check can use.
Questions
Do the rows I paste leave my browser?
Is the random sample genuinely uniform?
What does the random seed do?
Does the header count towards the number of rows?
Will the output match my original lines exactly?
How large an input can it handle?
Can I keep a fixed share of each category?
Related tools
- JSON to CSV — Flatten a JSON array into a CSV table.
- CSV to JSON — Turn a CSV file into structured JSON.
- CSV Viewer — Open and browse a large CSV without a spreadsheet app.
- CSV to Excel — Convert CSV files into an XLSX workbook.
- Excel to CSV — Export spreadsheet sheets to CSV.
- CSV Merge — Combine multiple CSV files with matching columns.