Home › Text Tools › Line Counter

Line Counter

Paste a list, log file, CSV or any text, or open a .txt file, and instantly see how many lines it has: total, non-empty, blank and unique. Check every line's length, find duplicates and see which lines are the longest.

Last updated:

0Total lines
0Non-empty lines
0Blank lines
0Unique lines
0Duplicate lines
0Longest line (chars)
0Shortest non-empty line
0Average line length
Advertisement
Advertisement

How to use the Line Counter

  1. Paste your text into the box, or click Open .txt file (you can also drop a file on the box).
  2. Read the totals: total lines, non-empty, blank, unique and duplicate lines update as you type.
  3. Adjust the options to ignore spaces or letter case when finding unique lines, or to count whitespace-only lines as blank.
  4. Check per-line lengths in the table, sort by longest or shortest, and view the length chart and most repeated lines.
  5. Copy the stats, copy the unique lines, or download a CSV with every line's length.

What each count means

Here is how the counter reads this six-line example (the third line is empty and the fifth contains only spaces):

red
blue

red
   
green
CountResultWhy
Total lines6Every line, including empty ones
Blank lines2Line 3 is empty; line 5 has only spaces (treated as blank by default)
Non-empty lines4Total minus blank: red, blue, red, green
Unique lines3red, blue and green
Duplicate lines1Non-empty minus unique: the second "red"
Longest line5 characters"green"

Line endings explained

NameCharactersUsed by
LF\n (line feed)macOS, Linux, Android, most web content and code repositories
CRLF\r\n (carriage return + line feed)Windows text files, many CSV exports, email and HTTP
CR\r (carriage return)Classic Mac OS (before 2001), rare today

The counter treats all three as one line break, so the line count is the same whatever system the file came from. "Mixed" means the text contains more than one style, which often happens when files are edited on different systems; a line ending converter can make them consistent.

Common uses

  • Lists and spreadsheets: check how many names, emails or SKUs are in a pasted column, and how many are duplicates.
  • Log files: count entries and spot the longest lines.
  • Code and config: count lines of code, blank lines and lines over 80 characters.
  • Poems and lyrics: count lines and stanzas (blank lines separate stanzas).
  • Data imports: confirm a CSV has the expected number of rows (remember the header row counts as a line).

Frequently asked questions

How are lines counted?

Every line break (LF, CRLF or CR) ends a line. A single line break at the very end of the text does not add an extra empty line, so "apple⏎banana⏎" counts as 2 lines, the same as most code editors. Empty text has 0 lines.

Why is my count one different from wc -l?

The Unix command wc -l counts line break characters, not lines. A file that does not end with a line break has one more line than wc -l reports. The tool shows both: total lines and the number of line breaks.

What counts as a blank line?

A line with no characters is blank. By default, lines that contain only spaces or tabs are also treated as blank; untick "Treat whitespace-only lines as blank" to count them as non-empty.

How are unique and duplicate lines calculated?

Unique lines is the number of different non-empty lines. Duplicate lines is the number of extra copies: non-empty lines minus unique lines. By default leading and trailing spaces are ignored when comparing; you can also make the comparison case-insensitive.

How is line length measured?

Line length is the number of characters on the line, not counting the line break. Emoji and other characters outside the basic plane count as one character, and tabs count as one character.

Can it handle large files?

Yes. Counting runs in your browser and handles files with hundreds of thousands of lines. The table shows the first 2,000 lines, and the CSV download includes every line.

Is my file uploaded?

No. Files are read with your browser's FileReader and never leave your device.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Remove Duplicate LinesDelete duplicate lines from any list, ignoring case or spaces, keep first or last, and sort.Remove Empty LinesDelete blank and whitespace-only lines, or collapse gaps to one, with before/after line counts.Add Line NumbersNumber every line of your text with custom start, step, padding and separator, or remove numbers.Paragraph CounterCount paragraphs in any text, with words and sentences per paragraph and the longest and shortest.Word CounterCount words and characters and clean up text.Character CounterCount characters with and without spaces, words, lines and bytes, with live limit bars.Grammar CheckerCheck grammar, spelling and punctuation with clickable suggestions and one-click fixes.Word Count to PagesHow many pages is 1,000 words? Estimate pages by font, size, spacing and margins.X Post Character CounterCount X (Twitter) post characters and split long text into a thread.YouTube Title Length CheckerCheck YouTube title length, preview truncation and score it for clicks.Text CompareFind the differences between two texts.Word Frequency CounterFind the most used words and phrases in any text and turn them into a word cloud.Sentence CounterCount sentences and paragraphs, see average sentence length and spot long sentences.Readability CheckerScore your text with Flesch, Flesch-Kincaid, Gunning Fog, SMOG and more readability tests.Keyword Density CheckerFind the most used 1, 2 and 3-word phrases in your text and their keyword density %.Reading Time CalculatorEstimate how long a text takes to read or speak at any speed, and copy a “5 min read” badge.Palindrome CheckerCheck if a word, sentence or number is a palindrome and find the longest palindrome in text.Syllable CounterCount syllables per word, line and total, and check haiku 5-7-5 instantly.Text SummarizerSummarize long text into its key sentences and keywords, privately in your browser.Spell CheckerCheck spelling online: misspelled words are highlighted with suggestions you can click to fix.DictionaryLook up English word definitions with pronunciation audio, examples, synonyms and antonyms.Letter Frequency CounterCount how often each letter appears, compare with English frequencies and see top bigrams.Antonym FinderFind opposites of any word: direct antonyms, near antonyms and definitions, click to copy.British to American Spelling ConverterConvert UK spelling to US spelling and back (colour/color, organise/organize) with highlights.Homophone FinderLook up homophones like there/their/they're with definitions and examples from 400+ sets.N-Gram GeneratorGenerate word or character n-grams (1-5) with frequency counts, stopword filter and CSV export.Passive Voice CheckerHighlight passive voice in your writing, see the passive sentence %, and get active rewrites.Periodic Table Word SpellerSpell words and names with chemical element symbols and download them as element tiles.Related Words FinderFind words related to any word or topic: associations, describing adjectives and more.Synonym FinderFind synonyms grouped by relevance, filter by syllables or first letter and click to copy.Text Similarity CheckerCompare two texts for similarity with cosine, Jaccard and Levenshtein scores and shared phrases.Words That Start With FinderFind words that start with, end with or contain any letters, filtered by length.AI Token CounterCount GPT tokens in any text, see every token highlighted and estimate the API input cost.Elevator Pitch GeneratorBuild 10, 30 and 60-second elevator pitches with word counts and speaking time.Abbreviation FinderLook up what common abbreviations and acronyms stand for, or find the abbreviation for a phrase.Describing Words FinderEnter a noun and get adjectives that commonly describe it, sorted by how often they are used.Keyword ExtractorPull the top keywords and key phrases from any text with RAKE or TF-IDF scores.Resume Keyword ScannerCompare your resume to a job description: match score, missing skills and keyword counts.Spelling PracticeType your weekly spelling words, hear each one read aloud, spell it and retry the misses.Spelling Test GeneratorTurn a word list into a spoken, auto-graded spelling test or a printable test with answer key.Transition Words FinderFind transition words by category with examples, and check the transitions in your essay.Writing Style AnalyzerHighlight hard sentences, adverbs, passive voice and complex words, with a grade level.Food Allergen CheckerPaste an ingredient list to highlight the 9 major food allergens and their hidden names.GC Content CalculatorDNA/RNA GC %, AT %, base counts, GC skew and a sliding-window GC plot from any sequence or FASTA.Google Ads Character CounterWrite responsive search ads with live 30/90/15 counters, pins, keyword insertion checks and a preview.ORF FinderFind open reading frames in all 6 frames of a DNA sequence, with positions, lengths and protein translations.Podcast Intro Script GeneratorWrite podcast intro and outro scripts in five tones, with sponsor, call to action and read time.Restriction Enzyme FinderFind cut sites for 180+ restriction enzymes in DNA, with fragment sizes, a site map and a virtual gel.SAT Vocabulary Flashcards363 high-frequency SAT words with definitions and examples: flip cards, quizzes and saved progress.Text HighlighterHighlight chosen words and phrases in several colors, count each one and copy the colored text.Scrabble Word CheckerCheck if a word is playable, see its Scrabble score, hooks, anagrams and two-letter word meanings.Sentiment AnalyzerScore the sentiment of reviews and messages per sentence, with positive and negative words.SMS Character CounterCount SMS characters and segments, detect GSM-7 vs Unicode and find the characters that cost extra.Social Media Character CounterCheck one post against X, Instagram, TikTok, LinkedIn, YouTube and more limits at once.Spelling Bee SolverEnter the 7 honeycomb letters to get every word, pangrams highlighted, points and a hint grid.
See all 53 Text Counters & Analyzers →