Skip to content

Word count in LaTeX

LaTeX has no word count of its own, but TeXcount counts the words in your text and skips the commands. On Overleaf, choose File > Word Count, which runs TeXcount for you. On your own computer, run texcount yourfile.tex in a terminal.

Character counterUpdated 3 min read

Overleaf

  1. Open your project.
  2. Choose File > Word Count.
  3. Read the total. Overleaf counts the project's main file and any files it pulls in with \include or \input, and leaves out the LaTeX commands.

Your main document has to sit at the top level of the project, not inside a folder, for the count to work.

By default the count leaves out references, headers, captions, floats and displayed maths. That's usually what a word limit means, but check your brief: some journals and universities count captions, or ask for the abstract on its own.

Including the reference list

Overleaf's documentation gives a workaround for a manual thebibliography list or BibTeX:

  1. Add %TC:incbib to the preamble of your .tex file.
  2. Add a file called latexmkrc, with no extension, to the project, with the line Overleaf's docs give.

This doesn't work with BibLaTeX, which TeXcount doesn't support.

Leaving a section out

Put %TC:ignore on the line before the part you want to skip, and %TC:endignore after it. Use it for an appendix, a title page or a statement that doesn't count towards the limit.

TeXcount on your own computer

TeXcount is a Perl script included in TeX Live and MiKTeX, so if you have LaTeX installed, you probably have it already.

  1. Open a terminal in the folder with your document.
  2. Run texcount mydoc.tex to see the count for that file.
  3. If your document pulls in other files with \input or \include, run texcount -inc mydoc.tex. You get one count per file and a total.
  4. Run texcount -v mydoc.tex to see colour-coded output showing which parts were counted.

The TeXcount author recommends checking that verbose output at least once, because the script can misread unusual macros. If a custom command hides text, or a package adds text TeXcount doesn't know about, the count will be off.

TeXcount also has a web interface on its home page, if you'd rather not install anything.

What counts as a word

TeXcount reports words in the text, words in headers and words in captions separately, and counts headers, floats and formulae as their own numbers. Maths isn't added to the word total, so equations don't inflate it.

Hyphenated words, numbers and abbreviations are where counters differ most. One tool counts "state-of-the-art" as one word, another as four. If your limit is strict, use the count your institution or journal names, and leave a margin.

Counting a section quickly

For one paragraph or an abstract, you don't need to run anything. Copy the text from the PDF, or from the source with the commands removed, and paste it into the counter on this page. It counts words and characters as you type, and handles text without the LaTeX commands getting in the way.

Word counter

Open the full tool

If the numbers don't match

Overleaf, TeXcount on your computer and a word processor can all give different totals for the same paper. The usual reasons:

  • One count includes captions, footnotes or the bibliography and the other doesn't.
  • Files pulled in with \input weren't included, because -inc was missing.
  • A custom macro wraps text that TeXcount skips.
  • Text copied from the PDF picked up running headers, page numbers or hyphenated line ends.

Decide which parts your limit covers, set the count up to match, and report that number.

Sources

Questions

Is there a word counter in LaTeX?

Not in LaTeX itself, but TeXcount does the job. It's a script that comes with most TeX distributions, and Overleaf runs it for you under File > Word Count.

How do I do a word count in Overleaf?

Open the project and choose File, then Word Count. Overleaf counts the main file and anything it pulls in with \include or \input, without the LaTeX commands.

Does Overleaf count references in the word count?

Not by default. Overleaf's docs describe adding %TC:incbib to the preamble and a latexmkrc file to include them, for BibTeX or a manual thebibliography list.