
You’ve finished the manuscript. The science is settled, the references compile, the figures finally sit where they should, and the submission portal asks for one last thing: word count.
That’s the moment many LaTeX users lose half an hour for no good reason.
You try a quick terminal command. The number looks wrong. You paste the PDF text into Word. That number looks wrong in a different way. You check your editor plugin, then Overleaf, then a shell script you found years ago. Now you have three totals and no confidence in any of them.
A good latex word counter isn’t just a convenience tool. It’s part of manuscript compliance. If you submit to a journal, a grant panel, or a university department, “close enough” often isn’t good enough. The hard part isn’t getting a number. The hard part is understanding why one number deserves your trust and another doesn’t.
Why Your Standard Word Count Fails on LaTeX
You finish a paper at 11:40 p.m., the submission form asks for a word count, and wc main.tex gives a number that looks plausible. Then you notice it counted citation keys, command names, labels, and pieces of equations. The problem is not getting a number. The problem is getting one that matches what an editor, grant officer, or thesis office means by "words."
A standard counter reads a .tex file as plain text. LaTeX is not plain text in that sense. It mixes visible prose with instructions about structure, formatting, references, floats, and math. A generic tool cannot tell the difference between words a reader sees and syntax LaTeX needs to compile the document.
That distinction matters more as the document gets more technical.
\section{Results}
We prove that $f(x)=x^2$ under the assumptions in Lemma~\ref{lem:main}.
\begin{figure}
\caption{A comparison of model outputs}
\end{figure}
A naive counter may treat \section, \ref, \begin, \end, figure, and parts of the inline math as countable tokens. For plain prose, the error may be small. For papers with equations, figure captions, tables, footnotes, and heavy citation markup, the error grows quickly.
The core issue is accuracy by purpose. Different contexts tolerate different kinds of approximation.
- Quick drafting check: a rough total is often fine if you only want to know whether you are near 6,000 or 9,000 words.
- Journal or grant submission: the count needs to reflect policy. Some venues include captions or references. Some exclude them.
- Automated workflow or CI/CD: the method has to be consistent and scriptable, even if you later adjust rules for edge cases.
That is why "word count" in LaTeX is really a parsing problem. The tool has to decide what counts as prose, what counts as metadata, and what to do with mixed cases such as captions, footnotes, and displayed equations.
A few trade-offs come up repeatedly in real manuscripts. Should \section{Introduction} count as one heading plus one visible word, or should the command disappear and only "Introduction" remain? Should \caption{...} count, given that many journals include captions in article length? Should bibliography entries count? There is no universal answer. The correct answer is the one that matches the submission rule you are trying to satisfy.
That is also why page-to-word estimates only help at the planning stage. If you need a rough benchmark while outlining a draft, this guide to how many words five pages usually represents is useful. It does not solve LaTeX-specific counting, and it should not be the method you rely on for final submission.
A practical rule has served me well: if the document uses citations, math, floats, or multiple input files, assume any non-LaTeX-aware count is only a rough estimate. Use it for planning, not for compliance.
Mastering TeXcount and Overleaf's Built-in Tool
If you need one answer to “what should I trust first,” it’s TeXcount.
TeXcount originated from Einar Andreas Rødland’s TeXcount project, and that project became foundational for modern LaTeX word count implementations. Overleaf’s own writeup explains the core reason it matters: standard tools such as wc can overestimate badly because they treat LaTeX commands as words, while TeXcount is designed to exclude LaTeX markup appropriately. Overleaf’s integration of TeXcount made accurate counting much easier for everyday users working in the browser (Overleaf on the history and purpose of TeXcount).
Use TeXcount from the command line
For local projects, command line TeXcount gives you the most control.
A basic run looks like this:
texcount main.tex
That’s enough for a quick report. But most real papers are not single-file documents. They use \input, \include, bibliographies, appendices, and custom environments. In practice, these flags matter more than the default command:
texcount -merge -total main.tex
Why this works better:
-mergefollows included files and counts the assembled document rather than one top-level file.-totalgives a clean overall total instead of making you add pieces by hand.
If your submission rules require counting references, try:
texcount -merge -incbib -total main.tex
That extra flag matters because bibliography handling is one of the biggest sources of confusion in LaTeX word counting.
For debugging, I like to inspect the fuller report before trusting the headline number:
texcount -merge -incbib main.tex
That usually reveals whether TeXcount is skipping or including something you didn’t expect.
Use comments to control what gets counted
TeXcount becomes much more useful when you annotate the source.
If a journal says figures and supplementary notes don’t count, mark those regions explicitly:
%TC:ignore
\begin{figure}
\centering
\includegraphics{plot.pdf}
\caption{Full benchmark output}
\end{figure}
%TC:endignore
If references must be included, add:
%TC:incbib
These comments make your count reproducible. That matters when coauthors ask why your final number changed after a minor revision.
The best LaTeX word count setup is the one that leaves a readable audit trail in the source.
You don’t want to remember, two days before submission, whether you counted captions this week but excluded them last week.
Know when TeXcount is the right choice
Use TeXcount when the document is any of the following:
| Scenario | Best choice | Why |
|---|---|---|
| Single journal article | TeXcount | Reliable default with little setup |
| Multi-file thesis chapter | TeXcount with -merge |
Handles split source cleanly |
| Submission with bibliography rules | TeXcount with directives | Explicit inclusion or exclusion |
| Shared project with coauthors | TeXcount plus source comments | Everyone sees the same logic |
If you only need a rough number while drafting, TeXcount may feel heavier than necessary. But for a final count you’re going to report externally, it’s the first tool I’d reach for.
Use Overleaf when you want TeXcount without terminal friction
Overleaf’s built-in word count is practical because it exposes TeXcount in a much more accessible way. You don’t need local installation, and you can inspect the count from inside the writing environment many researchers already use.
Here’s the interface many people rely on:

The hidden trade-off is that Overleaf’s convenience can make users forget they’re still dealing with configurable TeXcount behavior. The count is only “right” relative to the rules you’ve set.
Overleaf works best when you treat it like a configured tool
Inside Overleaf, the most useful habits are:
- Check bibliography behavior early: If references count for your target venue, add
%TC:incbibbefore the last week of revisions. - Mark excluded regions in source: Use
%TC:ignoreand%TC:endignorefor appendices, long figure blocks, or supplementary material. - Re-run after structural edits: If you split files, change class files, or move material into appendices, confirm the count again.
- Compare to venue guidance: Some journals care about captions; others don’t. TeXcount can only apply rules you define.
That’s the decision framework in practice:
- For a quick but trustworthy check, use Overleaf’s built-in counter.
- For a final submission number, use TeXcount deliberately with explicit directives.
- For a team workflow, keep the directives in the source so the counting logic travels with the document.
Exploring Alternative LaTeX Word Count Methods
You finish a grant draft at 11:40 p.m., the portal closes at midnight, and the LaTeX source says one thing while the submission rules imply another. That is the moment when alternative counting methods become useful. Not because they are better than TeXcount in general, but because each one answers a different question.
The practical question is not "Which tool counts words in LaTeX?" It is "How wrong can this method be for this document, and is that acceptable for what I am doing right now?" A rough drafting check, a final submission count, and a CI sanity test do not need the same level of accuracy.
The quick check with detex and wc
For a fast estimate, many people still use:
detex main.tex | wc -w
Or:
untex main.tex | wc -w
This works by stripping LaTeX commands and counting what remains. It is fast, easy to install, and good enough when the goal is to catch obvious growth in a draft.
It also fails in predictable ways. Math can disappear too aggressively or leave artifacts behind. Verbatim content, nested macros, and custom environments often confuse plain stripping tools. On prose-heavy articles, the result can be close enough. On technical papers with theorem blocks, notation, and macro-heavy formatting, it can drift far from what a journal editor expects.
Use detex or untex for a rough check. Do not use them as your reported number unless the venue explicitly accepts a plain-text approximation.
Scripted parsing in Python or R
Scripts make sense when your counting policy is specific and TeXcount's defaults do not match it cleanly. I have used small scripts for internal dashboards and CI checks where the exact submission number mattered less than consistency across revisions.
A minimal Python example looks like this:
import re
import sys
def count_latex_words(path):
text = open(path, encoding="utf-8").read()
text = re.sub(r'%.*$', '', text, flags=re.MULTILINE)
text = re.sub(r'\\[a-zA-Z]+(\{[^}]*\})?', '', text)
text = re.sub(r'\$[^$]*\$', '', text)
words = re.findall(r'\w+', text)
return len(words)
print(count_latex_words(sys.argv[1]))
The advantage is control. You can decide how to treat comments, inline math, front matter, or local macro conventions. That is useful for lab workflows, long-running projects, or automated alerts when a manuscript crosses a threshold.
The downside is maintenance. Regex-based parsing breaks on nested structures, complex macro arguments, and edge cases such as escaped symbols or multilingual content. Once a script grows past a few substitutions, you are effectively building a partial LaTeX parser. That is usually a bad bargain if the count will be used for submission.
A custom script is best for internal consistency. TeXcount remains the safer choice for counts you may need to defend.
Pandoc as a conversion-first strategy
Pandoc answers a different need. Instead of stripping commands, it converts the document into a simpler representation and lets you count that output:
pandoc main.tex -t plain | wc -w
This approach can be surprisingly useful for prose-heavy documents with conventional structure. If the source contains many formatting commands but the underlying content is ordinary text with section headings, lists, and citations, Pandoc often produces a readable plain-text version that is easy to inspect.
That inspectability matters. If the count looks odd, you can read the converted output and see what happened. With a regex pipeline, debugging is usually harder.
Pandoc is less reliable for documents built around custom environments, unusual citation setups, or heavy mathematics. It is a second opinion, not a final arbiter.
Editor plugins and online tools
Editor extensions and browser-based counters reduce friction. Open a project, click once, get a number.
That convenience hides two common problems. First, many tools do not explain their counting rules clearly. Second, the underlying parser may not match your document structure well, especially if you split files, redefine commands, or use discipline-specific packages.
For draft work, that may be acceptable. For a fellowship application with a strict cap, opaque rules are a liability. If a tool cannot tell you how it treats captions, math, citations, or included files, treat its output as advisory.

Which method should you choose
Choose the method based on the decision you are making, not on convenience alone:
- Need a five-second draft check:
detexoruntexpluswc - Need a second opinion on readable prose output: Pandoc
- Need a repeatable internal rule for a team or CI job: Python or R script
- Need a number for final submission: TeXcount, configured deliberately
- Need low-friction visibility while writing: editor or platform-integrated tooling
Manual copy-and-paste into a word processor sits at the bottom of the list. It strips away too much structure, and it gives you very little insight into why the number changed.
Customizing Counts for Complex Documents
The hardest LaTeX word count problems aren’t about tools. They’re about policy.
Should the bibliography count? Do captions count? What about displayed equations, footnotes, theorem environments, front matter, appendices, or acknowledgments? Different journals and departments answer those questions differently, and LaTeX tools don’t enforce one universal standard.
Overleaf’s documentation makes this clear. Counting behavior for citations, headers, captions, and math can vary, and including references may require directives such as %TC:incbib rather than a simple click in the interface (Overleaf documentation on word count behavior and %TC:incbib).

Bibliographies are the first thing to settle
If the venue excludes references, leave the default behavior alone unless your setup says otherwise.
If the venue includes references, make that explicit:
%TC:incbib
Then rerun your count. Don’t assume the platform already does this the way you expect.
A lot of submission-day confusion comes from people comparing counts generated under different bibliography rules.
Submission habit: Write down your counting policy in a short comment block at the top of the main
.texfile.
A few lines like “bibliography included, appendix excluded, captions included” save real time later.
Exclude figures, tables, and supplementary blocks deliberately
Figures and tables cause trouble because the visible text may or may not count depending on the venue.
If a section should be ignored entirely, wrap it:
%TC:ignore
\begin{table}
\centering
\caption{Hyperparameter search space}
\begin{tabular}{ll}
...
\end{tabular}
\end{table}
%TC:endignore
This works better than mentally subtracting counts or maintaining a separate spreadsheet of exceptions.
For appendices or supplementary matter, the same pattern applies:
%TC:ignore
\appendix
\section{Additional proofs}
...
%TC:endignore
Math needs a policy before it needs a tool
Math-heavy documents are where word limits get messy.
For some venues, displayed equations are treated as outside the word count. For others, equations embedded in the prose effectively replace words and should be treated as part of the argument. The main point is consistency. Pick the policy that matches the venue, then configure your counting process around it.
A practical checklist helps:
- Pure prose paper: Count text, captions, and possibly references if required.
- Methods-heavy article: Decide whether equation blocks are excluded and document that choice.
- Math thesis or theorem-heavy paper: Check whether the institution prefers page-based limits instead of raw word counts.
- Grant proposal: Verify whether headings, figure legends, and references are capped together or separately.
If your count still looks odd after configuration, inspect these common causes:
| Problem | Likely cause | Fix |
|---|---|---|
| Count is too high | Commands or hidden sections included | Add ignore regions or review tool flags |
| Count is too low | Bibliography or included files skipped | Enable bibliography and merge settings |
| Count changes unexpectedly | Different environment or plugin logic | Standardize on one configured method |
The best latex word counter setup is not the one with the fanciest interface. It’s the one where every inclusion rule is visible, documented, and repeatable.
How to Automate Word Counts in Your Workflow
The worst time to discover a bad counting method is the night before submission. A grant PDF looks fine, the draft feels complete, and then the official count changes because one machine included the bibliography and another did not.
Automation fixes that by turning word count into a defined part of the build, not a last-minute check. The core benefit is not speed. It is consistency. If the same command runs every time, you can compare drafts, enforce limits, and explain the number you submit.

Start with a simple shell script
For solo work, a shell script is usually enough. It removes guesswork and keeps the counting rules close to the source.
#!/usr/bin/env bash
set -e
FILE=${1:-main.tex}
texcount -merge -incbib -total "$FILE"
Save it as wordcount.sh, make it executable, and run it the same way you run your build. This approach is best when you need a quick, repeatable check during drafting and revision.
A fallback can help on systems where TeXcount is unavailable:
#!/usr/bin/env bash
set -e
FILE=${1:-main.tex}
untex "$FILE" | wc -w
Use that fallback carefully. It is better than raw wc because it strips some LaTeX markup first, but it is still a fallback. For final submission counts, TeXcount remains the safer default because its inclusion rules are explicit and easier to audit.
Add word count to your Makefile
If the project already uses make, add the count there and stop relying on memory.
wordcount:
texcount -merge -incbib -total main.tex
make wordcount is simple, but it changes team behavior. Coauthors stop running slightly different commands. Supervisors and research assistants stop reporting different totals from the same source tree. That matters more than convenience.
This also fits naturally into a broader content creation workflow where drafting, review, and validation all follow named steps instead of ad hoc habits.
Track progress with Python
Sometimes the count itself is the output. Sometimes the trend matters more.
import subprocess
import csv
from datetime import date
result = subprocess.check_output(
["texcount", "-merge", "-incbib", "-total", "main.tex"],
text=True
)
with open("wordcount-log.csv", "a", newline="") as f:
writer = csv.writer(f)
writer.writerow([date.today().isoformat(), result.strip()])
A log like this is useful for thesis chapters, revision sprints, and proposal drafting under a hard cap. It shows whether the document is tightening or just moving text around. In practice, that kind of visible progress can also increase productivity, especially when a project has multiple rounds of cuts.
Run checks in CI
CI is the right choice when the count must stay stable across collaborators or branches. It is less about convenience and more about enforcement.
A basic GitHub Actions job can run TeXcount on every push or pull request:
name: Word Count Check
on: [push, pull_request]
jobs:
wordcount:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install TeX Live
run: sudo apt-get update && sudo apt-get install -y texlive-extra-utils
- name: Run TeXcount
run: texcount -merge -incbib -total main.tex
This is the right level of automation for shared papers, lab templates, and grant repositories. Everyone gets the same environment and the same command. If the venue has a hard cap, you can go one step further and fail the build when the count crosses a threshold.
Choose the lightest system that matches the risk. A shell script works for quick checks. A Makefile target works for repeatable local builds. CI makes sense when the number needs to be visible, enforced, and reproducible right up to submission.
Frequently Asked Word Count Questions
Why is my count still wrong even with a LaTeX-aware tool
Usually the issue is configuration, not arithmetic.
Check whether the tool is following included files, whether the bibliography is included, and whether ignored regions are marked correctly. Custom macros, unusual environments, or malformed source can also confuse the parser.
My editor says one number and TeXcount says another. Which should I trust
Trust the method whose counting rules you can inspect.
If the editor plugin doesn’t clearly tell you how it treats citations, captions, math, and included files, use TeXcount or Overleaf with explicit directives. A visible rule set beats a convenient mystery number.
How should I count multilingual or UTF-8 documents
Use UTF-8 consistently across the project and test the output on a representative section before relying on the final total.
Scripted regex methods can struggle with non-ASCII text, so if your document mixes languages or uses many accented characters, a dedicated LaTeX-aware tool is the safer default.
What if my document is math-heavy and the word limit feels unfair
Check the venue rules carefully.
Some institutions and departments recognize that standard word counting is a poor fit for mathematical writing and may specify page-based limits or separate exclusions for figures, tables, appendices, and front matter. Don’t force a raw word count if the rules allow a more appropriate measure.
How do I get a character count instead of a word count
LaTeX tools focus mostly on words, so character counting often requires a different script or a plain-text conversion step.
If the venue asks for characters, first produce a cleaned text representation, then count characters on that cleaned output. Use the same inclusion rules you’d apply for words.
Should I copy the PDF text into Word and count it there
Only as a rough check.
PDF extraction often mangles ligatures, equations, footnotes, and line breaks. It can be useful for spotting major mismatches, but it’s a weak method for final reporting.
How long should an essay or paper be if the instructions seem vague
Use the exact venue guidance first. If the instructions are broad and you just need a planning benchmark, a general length guide can help. For student writers, this essay word count guide is a practical reference point before you move to a document-specific count.
If you’re polishing a paper, proposal, or article after the counting is done, Natural Write is a useful final-pass editor for making drafts sound more natural and readable without flattening your original ideas.


