Claude Token Counter (Claude 3.5 & Claude 4)
Approximate token counts for Claude 3.5 and Claude 4. No upload, no sign-up.
Loading tokenizer…
Paste your text and instantly see an estimate of how many tokens it uses. Because Anthropic does not publish Claude's exact tokenizer, we use OpenAI's cl100k_base as a close approximation. Your prompt is never uploaded. No sign-up, no credits, no limits.
- Claude 3.5 & 4
- 200k context window
- Close approximation
- No upload
- Runs offline
How many tokens is my Claude prompt?
Paste your prompt into the box above. It is estimated using the cl100k_base tokenizer, which is the closest public proxy for Claude's internal tokenizer. The count updates as you type and nothing is uploaded. Use this to estimate costs or check if your prompt fits inside the 200k context window.
- Price
- Free, no credits, no sign-up
- Tokenizer
- cl100k_base (Approximate proxy for Claude)
- Models covered
- Claude 3.5 Sonnet, Claude 3.5 Haiku, Claude 4, Claude 3 Opus
- Context Window
- 200,000 tokens (approx.)
- Text uploaded to server
- No, runs 100% in your browser
- Input
- Any plain text, code, JSON or conversation
- Extras
- Characters, words, lines, chars-per-token ratio
- Best browsers
- Any modern browser (Chrome, Edge, Firefox, Safari)
- Works offline
- Yes, after the first load
- Not included
- Exact API match, image token counting, cost calculator
What is the Claude token counter?
This is a free, browser-based tool that estimates tokens for Anthropic's Claude models, including Claude 3.5 Sonnet, Claude 3.5 Haiku, and Claude 4. Because Anthropic keeps its tokenizer proprietary, we use the OpenAI cl100k_base tokenizer as a proxy. It is highly accurate for plain English, usually within 3-5%, but you should add a safety buffer for code or non-English text. It also reports characters, words, lines and the chars-per-token ratio. No file is uploaded, no account is required and the tool works offline after the first load.
It is best for drafting prompts, estimating API costs, and ensuring your long documents fit inside the 200k context window. It is not a substitute for Anthropic's official count_tokens API endpoint if you need exact billing data.
How to estimate Claude tokens in 3 steps
- 1
Paste your text
Paste your prompt, text document, or code into the box. The tool estimates as you type using the cl100k_base tokenizer.
- 2
Check the estimate
Read the approximate token count, plus characters, words, and chars-per-token ratio. Claude is already pre-selected.
- 3
Add a buffer
Because Anthropic uses a different internal tokenizer, add a 5-10% buffer to this number to be safe when budgeting your context window.
Features
Best Available Approximation
Anthropic does not publish Claude's tokenizer. We use OpenAI's cl100k_base tokenizer, which is the closest publicly available proxy. For most English text, it is within a few percent of the real count.
Check 200k Context Windows
Claude 3.5 and Claude 4 models have a massive 200,000 token context window. Paste long documents, codebases, or chat histories to ensure they fit before sending them to the API.
Clear "Approximate" Badge
We do not hide the fact that this is an estimate. The tool clearly displays an "Approximate" badge so you know the count is a guide, not an exact API match.
Live Character & Word Counts
See characters, words, lines, and the chars-per-token ratio alongside the token estimate. This helps you estimate the size of your prompt before you even send it.
Runs Entirely Locally
The tokenizer loads via JavaScript, so every count happens on your device. Your proprietary code, confidential data, and prompts are never sent to our servers or stored anywhere.
Clean, Fast Interface
No ads, no popups, no sign-up. Just paste your text, read the number, and go back to building. Works perfectly on desktop and mobile.
What you can use the Claude counter for
Staying under the 200k limit
Claude has a huge context window, but massive codebases or long PDFs can still overflow it. Paste your prompt here first to ensure it fits before triggering an API error.
Estimating API costs
Because this is an approximation, treat it as a safe buffer. Use the token estimate to guess your API costs, but leave a 5-10% margin for error when building your budget.
Comparing prompt versions
Write two versions of a system prompt and compare their token estimates. The shorter version is cheaper, faster, and often gets the same result.
Checking code token usage
Code uses more tokens per character than English due to brackets, punctuation, and indentation. Paste your snippet to see its true estimated count.
RAG pipeline budgeting
Sum your system prompt, retrieved chunks, and user message to check how many tokens you spend per turn. Make sure you leave room for the model's output tokens.
Verifying API billing
If your Anthropic API bill seems high, paste the text you sent. If the estimate is much higher than expected, you might be sending hidden whitespace or redundant context.
Claude Token Counter FAQ
Answers about accuracy, context windows, pricing, and why Claude counts are an approximation.
Accuracy & Models
Why isn't the Claude count exact?
Anthropic does not publish Claude's tokenizer to the public. Because we cannot run their exact code, we use OpenAI's cl100k_base tokenizer as a close approximation. For most English text, it is within a few percent of the real count.
Which Claude models does this cover?
It applies to all modern Claude models, including Claude 3.5 Sonnet, Claude 3.5 Haiku, Claude 4, and Claude 3 Opus. They all use a similar internal tokenizer.
How close is the estimate?
For plain English, it is usually within 3% to 5%. For code, math, and non-English languages, the difference can be larger because Claude and OpenAI tokenize symbols and characters differently.
How can I get the exact Claude token count?
You must use the Anthropic API. They provide a specific `/v1/messages/count_tokens` endpoint that returns the exact number for your prompt before you send it.
Context Windows & Cost
What is Claude's context window?
Claude 3.5 Sonnet, Claude 3.5 Haiku, and Claude 4 all feature a 200,000 token context window. This is massive and allows you to process entire books or large codebases at once.
How do I calculate the cost?
Find the current price per 1,000 tokens for your specific Claude model (check Anthropic's pricing page). Multiply your token estimate by that price. ToolDeck does not display dollar amounts because prices change frequently.
Does this count system prompt tokens?
Yes. Any text you paste into the box is counted. If you paste your system prompt and your user message together, you will get the total estimate for that request.
Tokens vs Characters
How many characters is a token?
For plain English, 1 token is roughly 4 characters. Code, math, and non-English languages use more tokens per character. Look at the "Chars / token" stat for the exact ratio.
How many words is 200k tokens?
Roughly 150,000 words of plain English. That is about the length of a large novel. For code or non-English text, the word count will be lower.
What this tool does well, and where it is limited
This page uses an approximation for Claude. Check this table to see if it fits your use case.
| Use case | Result | Notes |
|---|---|---|
| Counting Claude 3.5 / 4 tokens | Approximate | Uses cl100k_base as a proxy. It is usually within 5% of the real Claude tokenizer, but can vary on code and non-English text. |
| Counting GPT-4o or GPT-4 tokens | Use dedicated page | Claude uses a different tokenizer. Use the GPT-4o Token Counter or OpenAI Token Counter for exact matches. |
| Counting image tokens | Not supported | Image tokens are calculated based on resolution and detail level. This tool counts text only. |
| Calculating exact dollar cost | Not calculated here | Prices change often and differ between input/output. Multiply your estimate by the current Anthropic pricing yourself. |
| Very long text (over 100k tokens) | Works, may lag | Browsers can count large inputs but the UI may pause while the tokenizer runs. Split the text if you hit freezes. |
| Language other than English | Less accurate | cl100k_base is optimized for English. The estimate for Japanese, Chinese, or Arabic may drift further from Claude's actual count. |
Tips
Always use the API for exact counts
If you are building a mission-critical application, use Anthropic's official count_tokens API endpoint. This web tool is for quick estimates and drafting, not for production billing logic.
Watch out for whitespace
Newlines and tabs count as tokens. If you are pasting formatted JSON or code, removing unnecessary whitespace can save tokens without losing meaning.
System prompts run every time
A 1,000-token system prompt sent in a 10-turn conversation costs 10,000 tokens. Keep your system prompts as short as possible to optimize costs.
Add a safety buffer
Because this is an approximation, if your prompt is close to the 200k limit, trim it by another 5,000 tokens just to be safe.
ToolDeck vs other token counters
Many generic token counters give you a false sense of security for Claude. ToolDeck is transparent about using an approximation.
| Feature | ToolDeck | Generic counters |
|---|---|---|
| Uses a close approximation for Claude | Yes (cl100k_base) | Often guesses blindly |
| Your text is uploaded to a server | Never | Usually yes |
| Sign-up needed | Not required | Often |
| Free credits or paywalls | None | Often |
| Real-time counting as you type | Yes | Usually yes |
| Character, word and line counts | Yes | Sometimes |
| Works offline after loading | Yes | Usually no |
General comparison. Individual tools differ, and features, limits and pricing change.
Responsible use
The counter is a reference tool. Always confirm the exact count with the provider's API (Anthropic count_tokens endpoint) before you depend on it in production. Prices and tokenizers change; this page is updated when they do.
More free AI and developer tools
Model-specific counters and other browser tools. Nothing uploaded, ever.
Token Counter
Count tokens for GPT-4o, GPT-4 and Claude.
GPT-4o Token Counter
Exact o200k_base counting for GPT-4o and GPT-4.1.
OpenAI Token Counter
GPT-4, GPT-3.5 and GPT-4o tokens.
Claude Token Counter
You are hereEstimate Claude 3.5 and Claude 4 tokens.
System Prompt Token Counter
Count system prompt tokens before you send.
Video Editor
Free multi-track editor with AI captions.
Your prompts never leave your device
There is no upload step and no account. The tokenizer runs in your browser, so every count happens on your own device. You can check this yourself: open your browser developer tools, go to the Network tab, then paste text and watch for file uploads. You will not see any. Read how we keep it private.