Prompt Engineering 7 min read Updated Jul 7, 2026

How to count tokens in a prompt before you send it

Counting a prompt's tokens before you send it tells you whether it fits the model, what it will cost, and whether the end might get cut off. Here's how to check and trim.

Try the Token Counter

Why token count matters before you send a prompt

You paste a long prompt, hit send, and one of three things goes wrong: the model rejects it because it's over the context limit, the response quietly stops halfway because the input ate most of the window, or the bill is higher than you expected because every token counts. Knowing the token count before you send makes all three easier to catch early.

Token count is the unit that actually matters to a model — not the number of words or characters you see. Checking it up front turns "send and hope" into a quick, deliberate step: you learn the size, compare it to the limit, trim what you don't need, and send with headroom. You'll walk through that check with the Token Counter — you still run the final prompt in your own AI assistant or API, and you decide what to cut.

Tokens are not the same as words or characters

A token is a sub-word chunk the model breaks text into — not a word and not a character. In English it averages roughly four characters, or about three-quarters of a word, per token, but that ratio shifts with the content. Code, punctuation, and non-Latin scripts pack more tokens into the same visible length, so a character count can badly under- or over-estimate the real size.

This is why "my prompt is only 2,000 characters" tells you almost nothing about whether it fits a model's window. If you want the difference laid out on a real example, the Tokens vs Characters resource shows the gap side by side.

What to check before sending a long prompt

Before a long prompt goes out, three questions are worth a few seconds:

  • Does it fit? The input plus the space you need for the response has to stay under the model's context window.
  • What will it cost? Input tokens are billed on every call, so a bloated prompt is a recurring charge, not a one-off.
  • Will the answer get cut off? If the input takes most of the window, the model has little room left to respond, and long answers get truncated.

Step 1: Paste the prompt into the Token Counter

Start with the real number. Paste the full prompt — system instructions, examples, and the input you plan to include — into the Token Counter. It runs in your browser and gives an estimated token count for the text as a whole, not just a character tally.

Treat the figure as an estimate, not an invoice. Different providers tokenize the same text slightly differently, which is why the count is shown as a range rather than a single exact number. It's accurate enough to size a prompt and compare versions; the authoritative count is whatever your provider's own tokenizer reports.

Step 2: Compare the count with your model's limit

A token count only means something next to a limit. Take the number from Step 1 and set it against your model's context window, remembering to leave room for the response — a good rule of thumb is to keep the input well under the total so the answer has space.

If your real question is "will this whole conversation still fit once the model replies?", that's a fit check rather than a raw count, and the Context Window Estimator is built for exactly that. Use the Token Counter to measure the prompt; use the estimator to judge whether input plus response fits the window.

Step 3: Trim repeated instructions and unnecessary examples

Most oversized prompts are padded, not dense. The usual culprits are the same instruction stated three ways, a stack of near-identical examples, and long pasted context that isn't all relevant. Cut the repetition first — it is usually the safest way to reclaim tokens without losing meaning.

You decide what's safe to remove; nothing is trimmed for you. For the common patterns and what they save, the Reduce Token Usage resource shows what padding costs on a worked example. Aim to keep the one clearest version of each instruction and the smallest set of examples that still shows the model what you want.

Step 4: Decide whether to split, summarize, or send as-is

Once the fat is gone, one of three paths is usually right, and the choice is yours to make:

  • Send as-is — the trimmed prompt now sits comfortably under the limit with room for the response.
  • Summarize — the source material is long but you don't need all of it verbatim; condense it before including it.
  • Split — the task genuinely needs everything, so break it into ordered messages or steps so each stays within the window.

Step 5: Re-count after edits

Trimming and rewriting change the count, sometimes by less than you'd hope, so measure again. Paste the edited prompt back into the Token Counter and confirm it now fits with headroom before you send. Re-counting also catches the opposite problem: an edit that accidentally grew the prompt.

This last check is what makes the whole thing worth doing — you send a prompt you've actually measured, not one you assumed was fine.

Common mistakes

A few habits quietly cause context and cost surprises:

  • Counting characters instead of tokens. They don't map cleanly, especially for code and non-English text.
  • Forgetting the response needs room too. A prompt that fits the window on its own can still truncate the answer.
  • Ignoring the multiplier. A prompt sent thousands of times turns a small token saving into a large cost difference.
  • Assuming counts match across models. The same text tokenizes differently on different models, so a count that fit one may not fit another.
  • Not re-counting after edits. The whole point is to send a measured prompt, not an assumed one.

A worked example

Say you have a support-assistant system prompt with three restated "be concise" rules and five sample conversations, and you've set yourself a 1,500-token input budget so responses have room. A quick count and a trim look like this — the meaning is unchanged, but the prompt now has comfortable headroom:

Same prompt, measured before and after
Before trimming:  ~1,240 tokens   (close to the 1,500 budget, little room for the reply)
After trimming:   ~780 tokens    (one clear rule + two examples — comfortable headroom)

Where this fits in NewPrompt

Counting tokens is often one step in a larger cost or context effort. When trimming prompts is part of an ongoing push to cut spend, the AI Cost Optimization Workflow connects this measure-and-trim habit with the other tools that support it. And when you're working with large retrieved context — where token budgets are a constant concern — the Build a RAG System with AI project shows where that budgeting sits in the whole build. The measuring and structuring are where NewPrompt helps; the calls — what to trim, split, or summarize — are yours, and you run the final prompt in your own AI assistant or API.

Tools for this guide

Each generates the prompt described above — you run it in your own AI assistant.

Ready-made resources

Reusable prompts and templates for the exact steps in this guide.

Take it further

When this task is one step inside a larger workflow or build.

FAQ

Does the Token Counter give the exact number my model will bill?

No — it's a fast estimate, shown as a range because providers tokenize the same text differently. It's accurate enough to size a prompt, compare two versions, and stay clear of a limit, but the authoritative count is whatever your provider's own tokenizer reports on the actual call.

Is a prompt's token count the same as its word or character count?

No. A token is a sub-word chunk, averaging about four characters or three-quarters of a word in English, but that ratio changes with code, punctuation, and non-Latin scripts. A character count can be well off, which is why counting tokens directly is the reliable way to size a prompt.

Will cutting tokens lower my cost and stop context errors?

Fewer input tokens mean a lower per-call input cost and less chance of hitting the context limit, but you decide what to remove and you confirm the shorter prompt still does the job. NewPrompt helps you measure the size and spot the padding; it doesn't optimize, run, or send the prompt for you.