Text & String Utilities100% Client-Side

Get the Last N Lines of Text

Paste a block of text to retain a chosen number of lines from its end. The selected rows stay in their original order, so the last row of the input is still last. A final newline can contribute an empty line to the requested count. Use this page when you need the ending of a report, transcript, or list without copying the earlier rows.

Configuration Options
Input
34 chars•5 lines
Output

Reverse tool

Get the First Lines of Text

Extract the first lines of a pasted block. Choose how many line positions to keep, including blank rows, for a quick preview of a list or export.

Open Get the First Lines of Text

How to Use the Get the Last Lines of Text Online

  1. 1Paste the text, keeping any trailing line breaks you want included.
  2. 2Set Number of Lines to the number of positions to take from the end.
  3. 3Check whether the final row is blank before copying the excerpt.
  4. 4Use Head to inspect the opening rows or Extract Lines for a middle section.

Input & Output Examples

A count of two retains the final two stages in their original order.

Input Sample
draft
review
done
Expected Output
review
done

At a count of two, the final empty position takes one place in the excerpt.

Input Sample
top
end
Expected Output
end

Practical Developer Workflows

  • Copy the closing entries of a chronological list while keeping their original order.
  • Inspect the final lines of a generated report before comparing its ending with a fixture.
  • Prepare a short excerpt of a transcript that ends at the last supplied line.

Zero Server Uploads & Complete Privacy

Runs 100% in your browser; no data is uploaded to any server.

Notice a bug, calculation error, or outdated info?

Let us know directly so our engineering team can fix it.

Frequently Asked Questions

The tool selects an ending segment without reversing it. The last line stays last. Use Reverse Lines separately if the result should start with the final row and continue backward through the excerpt.

Explore Other Tools

12 suggested tools

View all tools