CSV Sample
Take first, last or seeded CSV samples and download a reproducible selection report.
This tool runs entirely in your browser. Your data is never uploaded, never stored, and never leaves your device.
Select first, last or reproducibly seeded CSV rows without replacement, preserving complete quoted records and exact text.
How to use it
- 1Load CSV and choose first, last or seeded selection.
- 2Set the data-row count and, for seeded selection, a whole-number seed.
- 3Create the sample and download CSV plus an optional selection manifest.
Example
- Input
- id 001 002 003 Last 2 rows
- Output
- id 002 003
What happens to your data
CSV sampling runs locally without uploading cell contents. The optional manifest records selected row positions and the seed, but no source cell values. A sample can still contain private records, so review it before sharing.
Last updated October 2026
Create a smaller CSV by taking the first rows, the last rows or a reproducible seeded sample without replacement. Keep the header, exact field text and complete quoted records while reducing a large export to a manageable debugging or import-test file.
A seeded sample can be regenerated from the same source row order, row count and seed. Download a separate selection manifest to record the chosen data-row positions without including their cell values.
How it works
Load or paste CSV, choose a method and specify a whole number of data rows. The header is always included separately and does not count toward that number. The count must be between one and the number of available data rows; the tool does not silently clamp an oversized request. Header-only sources cannot produce a sample.
First rows takes the first N data records; Last rows takes the final N. Both retain their original order. Quoted multiline fields remain one record, so a physical newline is not mistaken for a new row.
Seeded sampling uses a deterministic 32-bit Mulberry32 generator and a partial Fisher–Yates selection. Bounded draws use rejection sampling rather than a directly biased remainder. Each source-row position can be selected at most once, and selected rows are sorted back into source order before export. Equal-looking rows remain separate source records; sampling does not deduplicate their values. The seed is an integer from 0 to 4294967295, inclusive.
The same source row order, count and seed reproduce the same selection with this algorithm version. Editing or reordering the source can change which records are selected. Different seeds can occasionally produce the same sample, especially on small inputs. This deterministic generator is not cryptographically secure and does not guarantee a representative sample, fair lottery, experimental design or every possible permutation. Use a suitable audited statistical method for high-stakes research.
The JSON manifest records method, seed where relevant, algorithm version, total row count and selected 1-based data-row positions, excluding the header. It intentionally contains no cell values or source-file fingerprint. Keep the original source with it: the manifest alone cannot establish that two source files are identical or regenerate missing data.
Inputs are UTF-8 and limited to 2 MiB, 10,000 records including the header, 200 columns and 200,000 cells. Headers must be unique and nonempty. Malformed quoting or unequal field counts stops processing; surplus fields are never silently discarded. Choose comma, semicolon or tab for both input and output. Downloads use UTF-8 without a BOM and CRLF record endings. Field text is preserved, but original quoting style and physical record endings are not. The preview shows at most eight rows and six columns with long values abbreviated; downloads contain the complete result. Exports are capped at 10 MiB.
Optional formula protection prefixes formula-like cells, including negative numbers and dangerous-looking headers, with an apostrophe. It changes only the exported text, not which rows are selected. Spreadsheet handling varies; import sensitive identifier columns as text. Any header collision introduced by protection is rejected.
Files and pasted content are processed locally in this browser, not uploaded by the tool. Editing the input clears old results, and late file reads cannot replace a newer edit. Downloaded files stay on your device; handle them according to your own data policies. Changing the selection method, count, seed or protection setting clears the previous sample and manifest.
Worked example: A repeatable two-row fixture
- Input
- id,name 001,Mira 002,Leo 003,Ada 004,Kai 005,Noor Seeded method; count 2; seed 42
- Result
- id,name 002,Leo 004,Kai
This algorithm selects data-row positions 2 and 4. The export keeps their original source order and leading-zero IDs.
Common use cases
- Building a repeatable smaller importer test file
- Inspecting the beginning or end of an export without breaking multiline records
- Sharing a deliberately reviewed subset for debugging
- Recording exactly which source rows were selected for a test fixture
Frequently asked questions
Is the header counted as one of the requested rows?+
No. A request for ten rows means ten data records plus the header. A multiline quoted record still counts as one data row, not as several physical lines.
Can the same record appear twice?+
The same source-row position cannot be selected twice. Two different source records with identical field values can both appear because this tool does not deduplicate records.
Why are sampled rows still in their original order?+
Selection is seeded, but output is deliberately restored to source order. This makes comparing the sample with its original export easier. It is not a shuffle tool.
Is this suitable for a lottery or scientific sampling claim?+
No such guarantee is made. Mulberry32 is a small deterministic, noncryptographic generator. The tool is intended for reproducible data handling and test fixtures, not security, certified fairness or statistical representativeness.
What do I need to reproduce the result?+
Keep the unchanged source, source row order, delimiter, requested count and seed. The manifest records the algorithm and selected positions but does not contain source data or a cryptographic source fingerprint.
Related tools
CSV Column Editor
Keep, reorder and rename CSV columns without changing cell values or row order.
CSV Splitter
Split CSV records into smaller files, preserve quoted line breaks and download a ZIP locally.
CSV Filter
Filter CSV rows, select output columns and download a focused table without uploads.
CSV Validator
Check CSV syntax, row widths and headings without silently repairing data. Download a diagnostic report.