About the Head and Tail Text
The head and tail commands in Linux show the beginning and end of a file, but you don't need a terminal to do the same thing. Paste your text, choose what to keep and the tool does it. You can keep the first lines or the last lines, take a range such as lines 20 to 40, keep every second or tenth line, or leave out the first or last lines, for example to remove a header row. The result appears next to your text with a count of how many lines were kept, ready to copy or download. It is useful for logs, lists, CSV files, name lists and any text that has one item per line.
Updated October 2026
How to use the Head and Tail Text
- 1Paste your text, with one item on each line.
- 2Choose what to keep from the list.
- 3Enter the number of lines, or the first and last line numbers for a range.
- 4Read the result and the number of lines kept.
- 5Copy it or download it as a text file.
Handy ways to use it
- Trim a header row off a CSV pasted as text
- Look at the newest entries of a log
- Sample every 10th row of a big list
- Split a list into two by taking odd and even lines
- Take the top 50 names from a ranking
Counting lines
A line is anything separated by a line break, so a long wrapped paragraph on screen is still a single line if it has no break in it. If you need to split text into pieces by sentence or comma instead, use the Text Splitter. Line numbers start at 1, as in most editors, not 0 as in some programming languages.
Related tools
The Grep Text tool keeps lines that match a word or pattern, Sort Lines puts them in order, Remove Duplicate Lines cleans up repeats, the Text Splitter breaks text at commas or other separators and the Add Prefix and Suffix to Lines tool adds text to each line.
Features
- First N lines (head) and last N lines (tail)
- Range of lines by number
- Every Nth line, from any starting line
- Skip the first or the last N lines
- Shows how many lines were kept
- Copy or download
- Runs in your browser
Frequently asked questions
How do I get the first 10 lines of a text?
Choose First lines, enter 10 and paste your text. The first ten lines appear in the result box. This is the same as the head command in Linux and Mac terminals, without needing to open one.
How do I get the last lines of a text?
Choose Last lines and enter how many you want. If you ask for more lines than the text has, you simply get all of it. Last lines are useful for the end of a log file, where the newest entries are.
How do I remove the first line, such as a header row?
Choose Everything except the first lines and enter 1. The first line is dropped and the rest is kept. In the same way, choose Everything except the last lines to remove a footer.
How do I keep a certain range of lines?
Choose A range of lines, then enter the first and last line numbers, counted from 1. For lines 20 to 40, enter 20 and 40. If the end is past the last line, you get everything from the start of the range to the end.
How does every Nth line work?
Choose Every Nth line, enter N and the line to start at. With N equal to 2 starting at 1 you get lines 1, 3, 5 and so on. Starting at 2 you get lines 2, 4, 6. Use it to sample a long list or to split odd and even lines.
Does it change the lines?
No. Lines are kept exactly as they are, and only line endings are normalised. A blank line at the very end of your text is ignored and is not counted as a line.