Count lines | Count Your Lines Quickly

Use our Count Lines tool to find the total number of lines in any text. Paste your content for instant results.

In your browser Updated 05/2026

0 / 500,000
Drop file to load (max 5 MB)
Analysis Results
Total lines
0
Non-empty lines
0
Empty lines
0
Duplicate lines
0
Characters
0
Characters (no spaces)
0
Words
0
Paragraphs
0
Sentences
0
Reading time
0 min
Average line length
0
Longest line (chars)
0
Shortest line (chars)
0
Longest word
Unique words
0
Line endings
1
Paste or type your text into the input area, or drag-and-drop a text file.
2
Stats update automatically as you type. Click Analyze to force a refresh.
3
Use the transformation buttons (Remove duplicates, Sort, Trim, Add line numbers, etc.) to clean the input directly.
4
Click Copy results to grab a labelled summary you can paste into a ticket, README or email.
5
Need to start over? Click the trash icon to wipe the input and reset every counter.
Quick Tips
  • Drag and drop a .txt, .csv, .log, .md or code file directly onto the input area to load it instantly.
  • Press Ctrl + Enter (Cmd + Enter on Mac) to re-run the analysis.
  • Use the transformation buttons (sort, dedupe, remove empty) to clean a list before counting.
  • The Line endings field tells you whether the file uses Unix LF, Windows CRLF or classic Mac CR — useful when debugging cross-platform files.
  • Reading time uses an average of 225 words per minute — a research-backed pace for adult silent reading.
Real-time analysis

Sixteen metrics — total lines, empty, non-empty, duplicates, words, sentences, paragraphs, reading time and more — recompute as you type.

Deep text statistics

Average / longest / shortest line, longest word, unique-word count and Unix vs. Windows line-ending detection.

One-click transformations

Remove duplicates, sort, reverse, trim whitespace, strip empty lines or add line numbers — applied directly to the input.

Drag-and-drop file load

Drop any .txt/.csv/.log/.md/.json/.xml/.html/.css/.js/.py/.sql file (up to 5 MB) directly into the editor.

Half-million-character capacity

Handles up to 500,000 characters in the browser — enough for full chapters of a book, large logs or 10,000-line CSVs.

Fully private

All processing happens in your browser. Nothing is uploaded, logged or persisted.

Code analysis

Count SLOC (lines of code), spot empty/duplicate lines and review average line length before a refactor.

Writing & editing

Hit a word count, estimate reading time and check sentence pacing for an article, blog post or essay.

Data cleaning

Drop a CSV, dedupe lines, sort alphabetically and re-export — perfect for cleaning email lists or address dumps.

Email / SMS templates

Verify your message stays inside character limits with the Characters and Characters (no spaces) counters.

Log inspection

Quickly tell how many lines a log file contains, how many are blank, and whether the line endings match your platform.

SEO and content audits

Word count, paragraph count and reading time — the three metrics every content audit checklist asks for.

This tool also exposes a free JSON API and a Model Context Protocol (MCP) server, so AI agents and scripts can call it directly without scraping the page. No signup, no API key, CORS open.

curl -X POST https://mate.tools/api/v1/count-lines.php \
  -H "Content-Type: application/json" \
  -d '{"text":"line one\nline two\n\nline four"}'
import urllib.request, json

req = urllib.request.Request(
    "https://mate.tools/api/v1/count-lines.php",
    data=json.dumps({"text": "line one\nline two\n\nline four"}).encode(),
    headers={"Content-Type": "application/json"},
)
with urllib.request.urlopen(req) as r:
    print(json.load(r)["metrics"])
const r = await fetch("https://mate.tools/api/v1/count-lines.php", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ text: "line one\nline two\n\nline four" }),
});
console.log((await r.json()).metrics);

Add to claude_desktop_config.json (Claude Desktop), ~/.cursor/mcp.json (Cursor), or any other MCP-compatible client:

{
  "mcpServers": {
    "mate-tools": {
      "command": "npx",
      "args": ["-y", "@mate-tools/mcp-server"]
    }
  }
}

Download server.js · Full install guide: /api/mcp · Source code: view here

Frequently Asked Questions

Any line that contains only whitespace (spaces or tabs) or no characters at all between two newline markers. Lines with even a single visible character — including punctuation — are counted as non-empty.

Yes. Every Unicode code point counts as one character, including emojis, accented letters, CJK characters and symbols. The Characters (no spaces) counter strips whitespace only.

Yes — and the Line endings indicator is especially useful here. Empty-line and duplicate-line counts let you spot dead code or copy-paste mistakes before a code review.

The browser editor handles up to 500,000 characters comfortably. Larger files are best loaded via the Load file button (capped at 5 MB) so the parser never blocks the UI.

Reading time uses 225 words per minute, the average rate for adult silent reading on screen documented in reading research. Speakers reading aloud average ~150 wpm.

It detects which newline characters appear in the text: LF (Unix/Mac OS X/Linux/macOS), CRLF (Windows), CR (classic Mac OS 9 and earlier). Files with mixed endings can break compilers, diff tools and shell scripts.

Two lines are duplicates only if their entire content matches exactly, including case and whitespace. To dedupe more loosely, click Trim whitespace first, then Remove duplicates.

After running a transformation (sort, dedupe, etc.), the input area holds the new text — copy it with Ctrl+A → Ctrl+C, or click Copy results for the stats summary.

No. The entire analysis — including reading the dropped file — runs in your browser via JavaScript. Nothing is uploaded, no analytics records the text, nothing is persisted.

A paragraph is detected as a block of non-empty lines separated from other blocks by at least one blank line. If your document uses single-line paragraphs (no blank lines between), the count will reflect that.