Word & Character Counter

Count words, characters, sentences and paragraphs as you type, with a reading-time estimate and a list of the words you have repeated most. The panel header shows how many characters are left before the next common limit: 60 for a title tag, 155 for a meta description and 280 for a post on X.

Your Text
Counts
0
Words
0
Characters
0
No spaces
0
Sentences
0
Paragraphs
0
Reading time

Most used words

    1 Limits worth knowing by heart

    Meta description

    About 155 characters on desktop and closer to 120 on mobile. Google truncates by pixel width, so a line full of capitals gets cut earlier.

    Title tag

    Roughly 60 characters. Put the main keyword and topic in the first 40, because the end is the part that gets cut.

    Tweet / X post

    280 characters, and every link counts as 23 whatever its real length. This counter counts a link at its full length, so expect X to report fewer.

    Open Graph description

    Facebook shows about 300 characters and LinkedIn cuts off much earlier. Write the first sentence so it makes sense on its own.

    2 How each number is worked out

    Words are runs of non-whitespace characters. A hyphenated compound such as client-side counts as one word, and so does a dash or an emoji standing alone between spaces. Word processors that skip punctuation-only tokens can report a slightly lower number.

    Characters are counted by Unicode code point. A flag emoji is built from two code points and counts as two. Python's len() gives the same number, while JavaScript's .length counts UTF-16 units and reports 4 for the same flag.

    Sentences end at a period, question mark or exclamation mark followed by whitespace or the end of the text. Abbreviations such as e.g. and Dr. inflate the count a little, so treat it as an estimate.

    Reading time is words divided by 200 and rounded up, so 950 words shows as 5 min. Dense technical prose reads slower than 200 words per minute and a light list post reads faster.

    How to use the Word & Character Counter tool

    1. Type or paste into the left panel. Every counter updates as you type.
    2. Check the hint in the panel header. It shows how many characters are left before the next limit: 60 for a title tag, 155 for a meta description, 280 for a post.
    3. Scroll the right panel for the most repeated words, with each one's share of the total word count.
    4. Click Upload File to load a .txt or .md file from disk.

    How to count words and characters in JavaScript, PHP and Python

    JavaScript

    const text = "The quick brown fox. It jumped over the lazy dog!";
    
    const words = text.trim() ? text.trim().split(/\s+/).length : 0;
    const chars = [...text].length;              // by code point, not UTF-16 unit
    const charsNoSpace = [...text.replace(/\s/g, "")].length;
    const sentences = (text.match(/[^.!?]+[.!?]+(\s|$)/g) || []).length;
    
    console.log({ words, chars, charsNoSpace, sentences });
    
    // "abc".length is 3, but "👍".length is 2 and [..."👍"].length is 1.
    // Use the spread form whenever an emoji might show up.

    To count the way a reader sees it, use Intl.Segmenter with granularity 'grapheme'. A flag or a skin-toned emoji is several code points but one visible character.

    PHP

    <?php
    $text = "The quick brown fox. It jumped over the lazy dog!";
    
    echo str_word_count($text), PHP_EOL;          // ASCII only
    echo count(preg_split('/\s+/u', trim($text))), PHP_EOL;  // Unicode safe
    
    echo mb_strlen($text, 'UTF-8'), PHP_EOL;      // characters
    echo strlen($text), PHP_EOL;                  // bytes, not the same thing
    
    // Word frequency, ignoring case
    $counts = array_count_values(
        array_map('mb_strtolower', preg_split('/\W+/u', $text, -1, PREG_SPLIT_NO_EMPTY))
    );
    arsort($counts);
    print_r(array_slice($counts, 0, 5, true));

    strlen() counts bytes. On a UTF-8 string with any accent in it, that number is larger than the character count. For example, strlen('café') is 5 while mb_strlen('café') is 4.

    Python

    from collections import Counter
    import re
    
    text = "The quick brown fox. It jumped over the lazy dog!"
    
    words = text.split()
    print(len(words))                 # words
    print(len(text))                  # characters (Python 3 counts code points)
    print(len(text.replace(" ", "")))
    
    sentences = [s for s in re.split(r"[.!?]+", text) if s.strip()]
    print(len(sentences))
    
    common = Counter(w.lower().strip(".,!?") for w in words)
    print(common.most_common(5))
    
    # Reading time, at 200 words per minute
    print(-(-len(words) // 200), "min")

    Common errors and how to fix them

    The character count differs from Twitter or a form validator
    Each one counts something different. JavaScript's .length counts UTF-16 units, PHP's strlen() counts bytes, and X counts weighted characters with every link fixed at 23. Match the method to whatever enforces the limit.
    An emoji counts as two or four characters
    The emoji is made of several code points (and more UTF-16 units). To count what the reader sees, use Intl.Segmenter in JavaScript or a grapheme library in other languages.
    The sentence count is too high
    Abbreviations cause it. e.g., Dr. and version numbers at the end of a phrase all put a period before a space. No simple rule tells them apart from a sentence end, so treat the number as approximate.
    str_word_count returns the wrong number for non-English text
    str_word_count() is ASCII-only and treats accented letters as word boundaries. Use preg_split with the u modifier instead.

    Good to know

    Search results truncate by pixel width. Google cuts a title at around 600 pixels, which is roughly 60 characters of lowercase text but noticeably fewer if the title is full of capitals or wide letters. Treat 60 and 155 as guides, then check the result in a SERP preview before publishing.

    Specifications and references

    This tool follows the specifications below. Read them when you need the exact normative wording, for example to settle an edge case between two implementations.

    Frequently Asked Questions

    Does the character count include spaces?

    Both numbers are shown. Use the count with spaces for X posts, meta descriptions and most form limits. The count without spaces is what some translation and copywriting agencies bill on.

    How is reading time worked out?

    Words divided by 200, rounded up, so 950 words shows as 5 min. 200 words per minute is a common estimate for adult reading speed on general prose. Dense documentation reads slower and a light list post reads faster.

    How does it split sentences?

    On a period, question mark or exclamation mark followed by whitespace or the end of the text. Abbreviations such as e.g. and Dr. inflate the count slightly, so treat it as an estimate.

    Is there a keyword frequency list?

    Yes, under the counters. It lists up to 8 repeated words with each one's share of the total, which makes a word you have used 11 times on one page easy to spot. Common words such as the and with, and words under 3 letters, are left out.

    Does it count emoji as one character?

    No. The character count is by Unicode code point, so a flag or a skin-toned emoji made of two code points counts as 2. Python's len() gives the same number. JavaScript's .length counts UTF-16 units and reports 4 for a flag, so check which method your length limit uses.

    Related

    If you write in Markdown, the Markdown editor previews as you type. To compare two drafts, the diff checker shows what changed, and the slug generator turns the finished headline into a URL.

    More Text & Content Tools

    Browse all text & content tools

    Copied to clipboard!