LaTeX Word Counter

created by Affan :)

About this tool

Existing word counting solutions are poorly suited to LaTeX documents. General-purpose counters process raw source as plain text, producing inflated totals that include commands, preamble declarations, and environment syntax. TeXcount and Overleaf's built-in counter offer greater accuracy but present their own limitations: Overleaf's default "Total Words" counts only body text as interpreted by TeXcount, systematically excluding bibliography entries, citations, captions, and footnotes. TeXcount itself can be configured to include these elements, but doing so requires modifying command-line flags or compilation settings—a process that introduces friction disproportionate to the task of checking a document against a word limit.

This tool was developed to provide a purpose-built alternative. It performs single-pass parsing of LaTeX source entirely within the browser, requiring no server, no compilation step, and no external dependencies. The parser identifies and classifies the full structure of a .tex file: preamble content, sectioning commands, citation keys, figure captions, table environments, footnotes, mathematical expressions, and bibliography entries. Each element is assigned a typed token, and the word count is computed from whichever categories the user has toggled on. A colour-coded verbose view offers full transparency over every classification decision, allowing authors to verify precisely how each part of their document has been treated before submission.

The goal was something fast, transparent, and accurate enough to trust with a binding word limit—without requiring users to learn TeXcount flags or accept Overleaf's conservative defaults.

Affan · Land Economy Tripos · University of Cambridge

Privacy

All word counting happens entirely within the browser. No LaTeX source is transmitted, uploaded, or stored on any server at any point. The tool runs as a self-contained HTML file with no external connections, so document content never leaves the machine it is opened on.

The entire source code is visible and open-source (MIT License). You can verify these privacy claims by viewing the page source (right-click → "View Page Source" or Ctrl+U). No tracking, no analytics, no cookies. Any preferences you set are stored only in your browser.

Getting started

Paste your entire .tex file into the text area — preamble, \begin{document}, bibliography and all. The counter automatically strips the preamble and parses the rest. Press Count Words or Ctrl+Enter.

The \title{}, \author{}, and \date{} text within your document body are counted as body words — if these commands appear in the preamble (before \begin{document}), they are not counted.

Target word count

If your assignment has a word limit, enter it in the Target field. A progress bar will show your count, percentage, and signed difference. The bar turns red if you exceed the target.

Toggles

Each checkbox controls whether a category is included in the total. All are on by default. Turning one off excludes that category and updates the verbose view and structure counts live.

Citations
Each \cite-family command counts as 1 word per citation key (e.g. \citep{A, B} = 2 words). Inline text citations you type yourself ("Smith (2020) argues…") are body text regardless of this toggle.
Figure captions
All text inside \begin{figure}...\end{figure} environments.
Tables
All text inside table, tabular, tabularx, and longtable environments.
Footnotes
Text inside \footnote{} commands.
Mathematics
Display math (equation, align, etc.) and inline math ($...$). Each variable, number, or symbol command counts as 1 word. The summary separately shows "Math expressions" — the number of display-math blocks.
Headings
The text inside \section{}, \subsection{}, and \subsubsection{} commands. When off, heading titles are excluded from the total.
Bibliography
Everything inside \begin{thebibliography}...\end{thebibliography}.

Tabs

Summary
Categorised word counts, progress bar (if target is set), and keyword density for the 20 most frequent non-trivial words.
Structure
A hierarchical breakdown by section, subsection, and subsubsection. Click the total bar to expand the tree. Parent sections show the aggregate word count of themselves and all their children. Click any parent to expand or collapse its children.
Verbose
Your full document rendered with colour highlighting. Two view modes are available via the toggle at the top:
Categories
Every token highlighted by its category — body, citation, caption, table, footnote, math, bibliography, command, comment, preamble, and structural markers. Each has a distinct pastel colour so you can see exactly how the parser classified every piece of your source.
Included / Excluded
A simpler two-colour view. Everything that contributes to the total is highlighted green; everything excluded is highlighted red. A label beneath shows which categories are contributing to each. This lets you confirm at a glance that the counter is treating your document the way you expect.
Body text
Citations
Figure captions
Table contents
Footnotes
Mathematics
Headings
Bibliography
LaTeX commands — never counted
Comments — never counted
Preamble — never counted
Structural markers — never counted

How counting works

A single-pass parser classifies every character into a typed token. Both the word counter and the colour renderer read from the same token list, so they can never disagree. Words are counted by splitting on whitespace and filtering out LaTeX symbols and punctuation-only fragments.

Changelog

v1.0 — 20 Feb 2026

Initial release.

Report a bug

If you encounter unexpected behaviour, an incorrect word count, or a parsing error, please report it so it can be fixed.

Email: bugs@latexwordcounter.com

Issue tracker: github.com/affan/latex-word-counter/issues

When reporting, please include the LaTeX source (or a minimal example) that produces the incorrect result, the expected word count, and which toggles were active.

All counting happens locally in your browser. Your LaTeX is not uploaded or stored.
13px
Body text0
Citations0
Captions0
Tables0
Footnotes0
Math words0
Headings0
Bibliography0
Math expressions0
Total counted words0
Body
Citation
Caption
Table
Footnote
Math
Heading
Bibliography
Command
Comment
Preamble
Structural
Excluded