Want the numbers right now? Paste your text in the letter counter or the character counter.
Letters, characters and words
| Count | What it includes |
|---|---|
| Characters | Everything: letters, digits, spaces, punctuation, symbols and line breaks |
| Characters without spaces | Everything except whitespace |
| Letters | Only alphabetic characters |
| Words | Groups of letters and digits separated by spaces or punctuation |
The sentence "Hello, World! 123" has 17 characters, 15 without spaces, 10 letters and 3 words. The three tools linked above give you each of these numbers: characters, characters without spaces and letters only.
Count by hand
For short text, write the letters in groups of five or ten and count the groups. For a single letter, scan the text and make a tally mark each time it appears. It works for a word or a line, and it becomes unreliable after that, so use a tool for anything longer.
In Word and Google Docs
Both programs have a word count window with characters and characters without spaces. Look for Word Count in the review or tools menu. They do not show a letters only number, so paste the text into the letters only counter for that.
In Excel and Google Sheets
With the text in A1:
Characters: =LEN(A1) Without spaces: =LEN(SUBSTITUTE(A1," ","")) Count the letter e: =LEN(A1)-LEN(SUBSTITUTE(LOWER(A1),"e","")) Words: =LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1
The letter formula turns the text to lowercase first, so E and e are both counted. To count a letter across a range, wrap the formula in SUMPRODUCT. The word formula returns 1 for empty cells, so wrap it in IF(A1="",0,...) if you have blanks.
In code
// JavaScript: letters in any alphabet
const letters = (text.match(/\p{L}/gu) || []).length;
# Python
letters = sum(ch.isalpha() for ch in text)
// PHP
$letters = preg_match_all('/\p{L}/u', $text);
To count a single letter, replace the pattern with that letter and add a case-insensitive flag. In the terminal, wc -m file.txt counts characters, and grep -o e file.txt | wc -l counts the letter e.
Pitfalls that change the number
- Emoji and accents. Some programs count by code units, so an emoji can count as 2 characters and é written as e plus an accent as 2. Counting what the reader sees avoids this.
- Line endings. Windows ends a line with two characters, other systems with one. A good counter treats both as one break.
- Special spaces. Non-breaking spaces and tabs look like spaces but are different characters.
- Curly quotes and dashes. They are punctuation, not letters, even when copied from a document.
- Case. Decide if A and a are the same letter before you count a specific one.
See also
- Letter frequency counter to rank every letter in a text.
- Character frequency counter for digits, symbols and spaces too.
- Word frequency counter and line counter for words and lines.