← All tools
// TEXT

Text Head / Tail online

Extract the first or last N lines from any text — like Unix head and tail.

Text Head / Tail logo
by
CHUNKY
MUNSTER
Lines:
TEXT INPUT0 LINES
OUTPUT0 LINES

About Text Head / Tail

Extract lines from the start (head) or end (tail) of a text — just like the Unix commands. Useful for previewing large datasets, log files, or any multi-line content. Runs entirely in your browser.

How to Use the Text Head / Tail Tool

  1. Paste or enter your input into the text field.
  2. Configure any options (format, delimiter, encoding, or mode) using the controls above the output.
  3. The result updates instantly — no submit button required for most operations.
  4. Click Copy or Download to take the output to your next step.

Paste any text block, set N to the number of lines you want, and pick Head (first N) or Tail (last N). The tool splits on newlines, slices the array, and joins it back — exactly what Unix head and tail do, only without the command line and without uploading the file anywhere.

How the Text Head / Tail Tool Works

Useful for previewing the top of a CSV before importing, checking the last hundred lines of a build log, or trimming an oversized log paste before sharing it in a bug report. There is no maximum on N — request more lines than the input has and you'll just get the entire input back, with the actual line count shown in the summary row.

Frequently Asked Questions

What happens if N is larger than the number of lines?

You get the entire input back. The summary row tells you the actual line count so you know whether N was the limiting factor.

Does it preserve CRLF line endings?

Yes — line endings are detected and preserved on output. Windows-style CRLF and Unix LF inputs both round-trip correctly.

Can I do head and tail at the same time, like 'first 5 and last 5'?

Not directly — you'd need to run head, copy the result, then run tail on the original separately. A combined mode is on the roadmap.

Is there an offset / skip-first-N option?

Use the Text Line Range tool for that — it lets you extract any contiguous range like lines 50–150.

Explore the full suite of TEXT tools and 290+ other free utilities at Chunky Munster.