Longest & Shortest Line FinderLine Length Checker

Paste text, a log, or code to see the longest and shortest lines with their line numbers. Set a limit to flag every line that runs over.

Your input is never sent anywhere.

Details
Input text
Count by

Paste text to see line lengths

Results update as you type. Put one item on each line.

Find the longest line in a text, log, or code file

Scanning hundreds of lines by eye for the one that is too long is slow, and it is easy to miss. Paste your text here and the tool measures every line, then shows the longest line, the shortest line, and the line number of each.

Enter a limit and every line over it is flagged, so the same page works as a quick check for code style, titles, social posts, and SMS drafts. You can count characters, words, or UTF-8 bytes, and copy the lines you find.

When line length matters

Code and config files

Paste a file, turn off Ignore leading and trailing spaces, and set a limit such as 79 or 88 to list every line that runs over.

Titles, headlines, and ad copy

Write one candidate per line and set a limit of 60 to see which ones may get cut off in search results or ad slots.

Social posts and text messages

Put each draft on its own line and flag anything over 280 for an X post or 160 for a single SMS.

Logs, CSV exports, and lists

The shortest lines are often cut-off or empty records, and the longest are often runaway entries. Both stand out in the list.

How to check line lengths in 3 steps

  1. Paste your text into the Input text box, with one item on each line.
  2. Choose what to count (characters, words, or bytes). Add a limit if you want lines over it flagged.
  3. Read the shortest and longest lines, then copy a line, all tied lines, or the filtered list.

Note: There is no run button. Everything updates as you type, so you can change the unit or the limit and watch the results change.

How lines are counted

  • Blank lines are skipped, but line numbers still match your original text.
  • Ignore leading and trailing spaces is on by default. Turn it off to count indentation. A tab counts as 1 character, so tab-indented code may look wider in your editor than it measures here.
  • Characters counts each character you see as 1 when your browser supports Intl.Segmenter, and counts Unicode code points otherwise. Words splits on spaces and tabs. Bytes is the UTF-8 size.
  • A line is flagged only when it is longer than the limit. A line exactly at the limit passes.
  • If several lines tie for longest or shortest, all of them are shown. The card lists the first five.
  • The tool counts a URL at its full length. X counts every link as 23 characters, so a post with a long link can pass on X and still show as over 280 here.

Common line and character limits

Typical limits you can enter as the flag value. Platforms change their rules, so check the current ones before you publish.

WhereTypical limitNotes
Google title linkAbout 600 px, roughly 50–60 charactersCut by pixel width, so wide letters use more room
Meta descriptionAbout 920 px on desktop, roughly 150–160 charactersCloser to 120 characters on mobile
X post280 charactersStandard accounts. Links count as 23
Instagram caption2,200 charactersOnly the first 125 show before “more”
SMS (one message)160 characters, or 70 with emoji or non-Latin textOne emoji moves the whole message to the 70 limit
Python, PEP 879 charactersTeams may choose a longer limit, up to 99
Python, Black88 charactersThe default, and you can change it with --line-length

Why a character count is only a guide for search results. Google trims titles and descriptions by pixel width, not by character count. A string of wide letters such as W or M fills the space faster than a string of narrow ones such as i or l. Use the limit to catch lines that are clearly too long, and check close calls in a search preview.

Characters, words, or bytes: which count to use

Different limits are measured in different units. Pick the one your target uses.

Characters for titles, posts, and code

Most limits you see in writing and publishing are in characters, including spaces and punctuation. Use Characters for titles, captions, posts, and code style limits.
Emoji and accented letters add 1 each here, but a few systems count them differently. SMS is one: a single emoji can switch a message to the 70-character limit.

Words for slogans and short copy

Words splits each line on spaces and tabs. It suits headlines, taglines, and subtitle lines where the target is a number of words, such as a button label that must stay under five.
Hyphenated terms such as well-known count as one word.

Bytes for fields with a size limit

Bytes gives the UTF-8 size of each line. Plain English letters take 1 byte, many accented letters take 2, and emoji take 4, so a line can be short in characters and still large in bytes.
Use it when a database column, header, or API field is limited by size instead of by character count.

Mistakes that cause miscounted lines

Judging a search title by its character count alone

A title comes in at 58 characters, so it looks safe, but Google cuts titles by pixel width. A title full of wide letters can still be trimmed, while a longer one made of narrow letters fits.

💡 See the solution▼
Use the 60 preset to catch the clearly long titles, put the key words first, and check titles that land near the limit in a search preview.

Leaving Ignore leading and trailing spaces on for code

Most code style limits count the indentation, but the default setting removes leading spaces and tabs before it counts. A deeply indented line then looks shorter than it is.

💡 See the solution▼
Turn Ignore leading and trailing spaces off before you check code. Remember that a tab counts as 1 here, while an editor may show it as 4 or 8 columns wide.

Pasting a paragraph and getting one very long line

Text without line breaks is a single line. A pasted paragraph then shows one line with hundreds of characters, which tells you nothing about the sentences inside it.

💡 See the solution▼
Put one item on each line before you paste. For wrapped text copied from a PDF, join the broken lines first so each paragraph is one line.

Using characters when the limit is in bytes or SMS segments

A form field limited to a number of bytes, or an SMS with an emoji in it, can reject text that is under the limit in characters.

💡 See the solution▼
Switch the count to Bytes for size-limited fields. For SMS, remember that one emoji or non-Latin letter moves the whole message to a 70-character limit.

Questions about counting and limits

Q.How do I find the longest line in a block of text?

Q.

A. Paste the text into the input box. The tool shows the length of the shortest and longest lines, the line number of each, and the line itself. Blank lines are skipped. Put one item on each line, because a pasted paragraph with no line breaks counts as one line.

Q.What happens when several lines have the same length?

Q.

A. The tool shows all lines that tie for longest, and all lines that tie for shortest. The card lists the first five with their line numbers and says how many more there are. The copy button copies every tied line, one per line.

Q.What does the tool count: characters, words, or bytes?

Q.

A. You choose. Characters counts each character you see as one, so an accented letter or an emoji adds 1 when your browser supports Intl.Segmenter; otherwise it counts Unicode code points. Words splits the line on spaces and tabs. Bytes is the UTF-8 size, where plain English letters take 1 byte each and many other characters take more.

Q.How do I check which lines are over a length limit?

Q.

A. Type a number in the Flag lines longer than box, or click a preset such as 79, 88, 160, or 280. Lines longer than the limit turn red in the list, an Over card shows how many there are, and Only over turns the list into just those lines. A line exactly at the limit is not flagged.

Q.Do spaces and tabs count?

Q.

A. Spaces and tabs inside a line always count, and a tab counts as 1 character. Leading and trailing spaces are removed before counting while Ignore leading and trailing spaces is on, which is the default. Turn it off to count indentation, for example when you check code against a line limit.

Q.Are blank lines counted?

Q.

A. No. Empty lines are skipped, but the line numbers still match your original text, so line 12 in the results is line 12 in what you pasted. A line that contains only spaces is also skipped while the spaces option is on, and always in Words mode.

Q.Is 60 characters the right limit for a title tag?

Q.

A. It is a rule of thumb. Google cuts titles by pixel width, about 600 pixels on desktop, and that comes to roughly 50 to 60 characters. Wide letters take more room than narrow ones, so one 58-character title can fit while another does not. Use the 60 preset to catch long titles, then check close calls in a search preview.

Q.Does it handle Windows, Mac, and Linux line endings?

Q.

A. Yes. The text is split on Windows (CRLF), old Mac (CR), and Unix (LF) line endings, so lines from any of them are measured the same way.

Q.Is my text sent to a server?

Q.

A. No. The tool measures your text with JavaScript in your browser, and there is no upload step. Closing or reloading the page clears the text.

Q.Is there a limit on how much text I can paste?

Q.

A. The tool sets no limit. The results are recalculated each time you change the text or a setting, so a very large paste can feel slow on an older device. The list shows the first 30 lines, and Show all displays the rest.

User Feedback & Request

Your feedback
makes this tool better.

Tell us which features you'd like, what should be fixed, or which new tool you'd like to see. An engineer reads every submission and uses it to guide development.

Send feedback