Tk

LLM Token Calculator

Estimate how many tokens a text is from its words or characters, how much of a model's context window it fills, and what it costs at a price you enter.

Technology & ComputingRuns in your browser

Result…

Text length in

A word processor's word or character count.

An adjustable assumption. 0.75 is OpenAI's rule of thumb for English (100 tokens ≈ 75 words). Other languages, code and other tokenisers differ.

tokens

Room you want to keep free for the model's answer. 0 to leave it out.

tokens

From the model's documentation.

$

From the provider's price list, for input tokens. 0 to skip the cost.

 

…

How it's calculated

Tokens ≈ words ÷ words per token, or characters ÷ characters per token (rounded up)
Window used = (tokens + reply) ÷ context window × 100%
Cost = tokens ÷ 1,000,000 × price per million

Language models read text as tokens: whole words, pieces of words, punctuation and spaces. OpenAI's help centre gives rough rules for English: one token is about 4 characters or about three quarters of a word, so 100 tokens are about 75 words. Those are the starting values here, and you can change them, because the ratio depends on the model's tokeniser and on the text: other languages, source code and lists of numbers usually need more tokens per word. The context window is the most tokens a model can handle at once, counting your prompt, any attached files and the reply. Prices and windows change often, so take them from the provider's current documentation.

Your numbers, step by step

    About the LLM Token calculator

    This LLM token calculator estimates how many tokens a piece of text will use from its word or character count, then shows how much of a model's context window that fills and how much room is left for the reply. Enter a price per million tokens from your provider's price list and it works out the cost too. The starting ratios are rules of thumb for English from OpenAI's help article on tokens: one token is about 4 characters, or about three quarters of a word. They are assumptions you can change, because every model has its own tokeniser and other languages, code and numbers usually need more tokens. Use it to plan prompts, documents and budgets; for an exact count, use the provider's own tokeniser. The steps show each division with your numbers.

    How to use it

    1. Under “Text length in”, choose “Words” or “Characters”, and enter the “Text length”.
    2. Keep or change the “Words per token” or “Characters per token” ratio.
    3. Enter the “Context window” of your model and any “Tokens to leave for the reply”.
    4. Add a “Price per million tokens” to see the cost, or leave it at 0.
    5. Read the estimated tokens, the share of the window used and the room left.

    Worked example

    A 6000-word document at 0.75 words per token is 6000 ÷ 0.75 = 8000 tokens. With 4000 tokens kept for the reply in a 32,000-token window, (8000 + 4000) ÷ 32,000 = 37.5% is used and 20,000 tokens are left. At a price of 2.5 per million tokens, the document costs 8000 ÷ 1,000,000 × 2.5 = 0.02 in your currency.

    Updated

    Questions people ask

    How many tokens is 1000 words?

    About 1334 tokens (1000 ÷ 0.75 = 1333.3, rounded up) with the 0.75 words-per-token rule of thumb for English. Other languages and code often need more, so change the ratio if you have measured your own text.

    What is the formula for estimating tokens?

    Tokens ≈ words ÷ words per token, or characters ÷ characters per token, rounded up. The percentage calculator works out other shares of a limit.

    What does the context window include?

    Everything the model handles at once: system instructions, your prompt, attached files, earlier messages and its reply. Leave room for the answer, or the model may stop early.

    Why is my real token count different?

    Each model splits text with its own tokeniser, and the ratio changes with language, punctuation, numbers and code. The calculator gives an estimate from an average; the provider's tokeniser gives the exact count.

    Does the cost include the reply?

    No. It prices the estimated text tokens at the rate you enter. Output tokens are often priced differently, so check your provider's current price list and add them separately.

    More in Technology & Computing