Line Counter
Paste text, source code, a log file or a CSV and the counter returns total lines, non-empty lines, blank lines, unique lines and duplicate lines. Handy when a recruiter asks “how many LOC in this repo?”, when you need to know how many rows a CSV has without opening it in Excel, or when you want to check a wordlist for duplicates before feeding it into a script.
How to count lines
-
1
Paste the content
Up to a few megabytes of text: log, source file, markdown, list.
-
2
Read the breakdown
Total, non-empty, blank, unique and duplicate counts display at once.
-
3
Decide what counts
Comments, trailing newlines, blank-between-sections: your use-case decides.
-
4
Act on the count
Size the import, deduplicate, trim, or report the number as evidence.
What actually counts as a line
Different tools give different “line counts” for the same file because they make different choices on three points.
The three ambiguities
-
Trailing newline. POSIX text files end in
\n. Does the final newline add an extra empty line?wc -lcounts newlines, so a file with content on one line plus a trailing newline reports 1; a file with content and no trailing newline reports 0 (which is surprising). This counter reports “lines of content”, ignoring the final empty line after a terminator. -
Blank vs whitespace-only. A line with spaces or tabs but no visible character, is it empty or not? The counter treats whitespace-only lines as blank, matching most editors.
-
Single-line files. A one-line file without a trailing newline is still 1 line.
Counter outputs explained
| Metric | Definition |
|---|---|
| Total lines | All lines, including blanks, up to the last non-empty line |
| Non-empty | Lines with at least one non-whitespace character |
| Blank | Lines that are empty or whitespace-only |
| Unique | Distinct non-empty lines, case-sensitive |
| Duplicates | Non-empty lines that appear more than once (count of the duplicates) |
Common use cases
- Wordlist dedup, paste a wordlist, see duplicates count, then run through a deduplicator.
- CSV row count, paste the file body; subtract 1 for the header to get data rows.
- Log parsing, check that a rotated log has the expected number of entries.
- Source-file LOC, quick “how many lines in this file” without opening an IDE.
- Email list hygiene, see how many addresses are duplicates before sending a campaign.
LOC is not productivity
Line count of source code is a blunt measure. A dense, well-factored 100-line module can be harder to write and maintain than a sprawling 1,000-line one. Use line counts for scope estimates (fitting in a context window, paginating output, comparing file sizes) rather than performance evaluation.
Unicode and line terminators
The counter normalises \r\n, \r and \n to a single newline before counting, so Windows, classic Mac and Unix line endings all produce the same result. Unicode line separators (U+2028) and paragraph separators (U+2029) are also treated as breaks.
Frequently Asked Questions
wc -l counts newline characters, so a file with content and no final newline reports one fewer. This counter reports “number of lines of content”, which matches most editor status bars.
Yes, lines containing only spaces or tabs count as blank, not non-empty. That matches VS Code, Sublime and most Git workflows.
Yes. “Hello” and “hello” count as distinct unique lines. If you want case-insensitive dedup, lowercase your input first with a case converter.
No, the counter reads input locally and nothing is uploaded or logged.
Related Tools
Password Generator
Generate strong random passwords with adjustable length, symbols, numbers and mixed case using cryptographic randomness.
Word Counter
Count words, characters, sentences and paragraphs with reading time, speaking time, keyword density and a Flesch readability score for essays, posts, captions and meta descriptions.
Business Name Generator
Generate business name ideas from industry keywords and style choices, then use the checklist to verify domains, registries and trademarks.
Character Counter
Count characters, words, lines, sentences and paragraphs in any text. See totals with and without spaces plus a character breakdown.
Meme Text Generator
Add classic meme captions to a template or your own image. Set top and bottom text, tune font, color and stroke, then download or copy a PNG.
Username Generator
Generate username ideas from a seed word with optional numbers and separators. Handy for new accounts, gamer tags and alternate profiles.
Tool available in other languages
- Contador de Linhas [PT]
- Số dòng [VI]
- 行カウンター [JA]
- 줄 수 세기 [KO]
- Contador de Líneas [ES]
- عدّاد السطور [AR]
- Rekenaantal van regels [NL]
- Radräknare [SV]
- ตัวนับบรรทัด [TH]
- Compteur de lignes [FR]
- Kontainer Baris [ID]
- Zeilen Zähler [DE]
- Licznik linii [PL]
- Contatore di righe [IT]
- Счетчик строк [RU]
- Satır Sayacı [TR]
- 行计数器 [ZH]