Keep Last 40 Lines
Paste text and keep its final 40 lines locally in your browser.
Keeps exactly the last 40 lines, including blank lines and a trailing newline. Maximum 100,000 characters and 50,000 lines.
Paste text to begin.
A QUICK WALKTHROUGH
How to use this tool
- Enter up to 100,000 characters and 50,000 lines.
- Keep the final 40 lines, including blank lines.
- Copy or download the result from the output.
Exact line retention
The final 40 logical lines are retained. Blank lines count as lines, and an ending line break creates a final empty line that is retained when it falls within the final 40.
Line endings and limits
LF, CRLF, and CR separators are preserved exactly in the retained portion. Input is limited to 100,000 characters and 50,000 lines.
Local processing
Text stays in this browser and is not uploaded.
GOOD TO KNOW
Common questions
Do blank lines count?
Yes. Every logical line, including blank lines, counts toward the final 40.
Is a trailing newline preserved?
Yes, when its final empty line is among the retained lines.
What if the input has fewer than 40 lines?
The input is returned unchanged.