csvkit.org
CSV (Comma-Separated Values) utilities, in the browser
Say hi →

Slice CSV Rows

first N · last N · row range · every Nth · skip from either end · header kept

Cut a CSV down to the rows you need — the first 100 for a quick look, the last 50 to see recent records, rows 500–600 to inspect the middle, or every tenth row to thin a huge export. It's head and tail for CSV, except the header row is always carried through so the result stays a valid file.

slice
Or drop a .csv file here, or
ready

How to slice a CSV

  1. Paste the CSV or drop a file.
  2. Pick a mode and set N. For a range, N is the first row and to row is the last — both counted from 1, both inclusive, ignoring the header. Fields that don't apply to the current mode are hidden.
  3. Read the status line to confirm how many rows were kept out of how many.
  4. Copy or download the result.

What each mode is for

Slicing versus sampling

Slicing is positional and reproducible: the same input always gives the same rows. That's what you want for debugging a specific region or trimming known junk. If you want rows that represent the file rather than one part of it — because it's sorted by date, region, or ID and any slice would be biased — use Random sample, which can also take a seed so the selection is repeatable.

FAQ

Does N count the header row?

No. N counts data rows, and the header is always kept on top of the output.

What if N is bigger than the file?

You get the whole file back, and the status line shows the real number of rows kept.

How do I split a file into equal chunks instead?

Split CSV does that, and can hand you every chunk as a single zip.

Is anything uploaded?

No. Slicing happens in your browser.

Privacy

100% client-side. No upload. See the privacy policy.