Find the Longest and Shortest Line
Find the longest and shortest lines in a text and rank every line by length.
- Free
- Real-time
- Runs locally
Options
Measure length in
Lines
0
Measured
Longest
0
Characters
Shortest
0
Characters
Average
–
Longest line
Paste some lines to find the longest line.
Shortest line
Paste some lines to find the shortest line.
All lines by length
0 linesOrder
Lines appear here ranked by length.
Paste a list, a file or a block of code and instantly see which line is the longest and which is the shortest, how long each one is and where it sits. Ties are reported, so you know when several lines share the same length.
Every line is also ranked by length, from longest to shortest or in its original order, with the average and median line length. Measure in visible characters or in words, ignore empty lines and stray spaces, and copy or export the ranking. All processing happens in your browser.
How to find the longest line
- STEP 01
Paste your lines
Paste any text with several lines. The longest and shortest lines are found as you type.
- STEP 02
Choose how to measure
Measure in characters or words, and decide whether to ignore empty lines and spaces at line ends.
- STEP 03
Review the ranking
Check the longest and shortest line, browse every line by length, and copy or download the list.
Features
Longest and shortest at a glance
Both lines are shown in full with their length, line number and any ties.
Characters or words
Measure line length in visible characters, where emoji and accents count as one, or in words.
Every line ranked
Sort all lines from longest to shortest, shortest to longest, or keep their original order.
Average and median
See the typical line length, not just the extremes.
Clean measurements
Skip empty lines and ignore leading and trailing spaces so they do not distort results.
Copy and CSV export
Copy the lines in ranked order, or download line numbers, lengths and text as CSV.
When line length matters
Knowing your longest and shortest lines helps in many situations:
- Checking code against a line length limit such as 80, 100 or 120 characters.
- Finding product titles, meta descriptions or SMS messages that are too long.
- Spotting truncated or empty-looking entries in a list or data export.
- Checking subtitle or caption lines against a character limit per line.
Frequently asked questions
How is line length counted?
In visible characters by default, the same way as our Character Counter: an emoji or an accented letter counts as one. You can also measure in words. Spaces at the start and end of a line are ignored unless you turn that option off.
What if several lines have the same length?
The first one in the text is shown, and the panel tells you how many other lines share the same length. The full ranking lists all of them.
Are empty lines counted?
Not by default. Turn off “Ignore empty lines” to include them; the shortest line will then usually be an empty line with length 0.
Can I sort lines by length?
Yes. The ranking can be ordered longest first or shortest first, and “Copy lines in this order” copies the sorted lines. Our Sort Lines tool also sorts by length with more options.
How many lines can it handle?
Hundreds of thousands. Large texts are measured in a background thread so the page stays responsive.
Is my text uploaded?
No. Lines are measured in your browser and nothing is sent to a server.