Embed a Free AI Token Calculator on Your Site

TokenCalc embed widget — free, no API key, one line of HTML · updated 2026-09-30

Paste one line and your page has a working token calculator. No backend, no API key, no build step, no account. Visitors count tokens and estimate API costs for 70+ models — GPT-5.5, GPT-4o, Claude Opus 5.5, Gemini 3.1 Pro, DeepSeek V4, Qwen3 — with OpenAI counts computed by the official tiktoken tokenizer, right there in their browser.

Jump to the code, or preview it live below. For data instead of a widget, use the pricing JSON endpoint.

Live preview

This is the real widget, exactly as your visitors will see it — only the model preset changes with the selector below.

The one-line embed

Drop this anywhere in the <body> of the page where you want the calculator. The script creates the iframe and sizes it for you.

<script src="https://tokenestimate.com/js/embed.js" data-model="gpt-5.5" data-height="640"></script>

Options

AttributeDefaultWhat it does
data-modelgpt-4oModel preselected when the widget loads. Use any id from the deep-link table below.
data-height640Iframe height in pixels. 640 fits the calculator plus the pricing table; 520 hides the table behind a scroll.
data-creditonSet data-credit="off" to drop the small "Token calculator by TokenCalc" line under the widget. Linking back keeps it free.

Iframe version (no script allowed)

Some CMSs, Shopify themes and docs platforms strip third-party <script> tags. Use the raw iframe instead — it is the same widget:

<iframe src="https://tokenestimate.com/?embed=1&model=gpt-5.5"
        title="AI Token Calculator" loading="lazy"
        style="width:100%;max-width:1080px;height:640px;border:1px solid #dfe6f1;border-radius:16px"></iframe>

The ?model= parameter works on any page and takes a model id. The ids below cover the models people embed most; the full catalog of 70+ is in the calculator's own model dropdown.

ModelidToken count
GPT-5.5gpt-5.5exact
GPT-5 / mini / nanogpt-5 · gpt-5-mini · gpt-5-nanoexact
GPT-4o / minigpt-4o · gpt-4o-miniexact
GPT-4.1 familygpt-4.1 · gpt-4.1-mini · gpt-4.1-nanoexact
Reasoning modelso3 · o4-mini · o3-mini · o1exact
Claude Opus 5.5 / Sonnet 5claude-opus-5-5 · claude-sonnet-5estimate
Claude Haiku 4.5claude-haiku-4.5estimate
Gemini 3.1 Pro / Flashgemini-3.1-pro · gemini-3.6-flashestimate
DeepSeek V4 Pro / Flashdeepseek-v4-pro · deepseek-v4-flashestimate
Qwen3 Max / Coderqwen3-max · qwen3-coderestimate
Llama 4 / GLM / Kimillama-4 · glm-5 · kimi-k2.6estimate

?embed=1 is the other half: it strips our header, footer and ads so only the calculator renders. Use it whenever you point an iframe at us.

What the widget gives your visitors

  • Exact OpenAI counts — official o200k_base and cl100k_base BPE tokenizers via js-tiktoken, running in the browser.
  • Calibrated estimates for Claude, Gemini, DeepSeek, Qwen, Llama, GLM, Kimi, Doubao and more (~5–10% accuracy).
  • Live cost estimates per run and per 1M tokens, with prices every visitor can edit in the UI.
  • Character / word / line / byte counts alongside the token total.
  • Privacy — input never leaves the visitor's browser, so nothing on your site collects it either.

Terms

  • Free for any site, commercial included. No rate limits, no key.
  • Keep the credit link, or link to https://tokenestimate.com/ somewhere on the page. That is the whole price.
  • Do not present the widget as your own product, and do not frame it behind a paywall.
  • Prices are public list prices, verified 2026-09-30 — not contract, batch or cached-rate pricing. Machine-readable data with its own verification date lives at /api.html.

Troubleshooting

  • The widget is blank — your host may block iframes. Check for X-Frame-Options or a CSP frame-src rule; our site sends neither, so the restriction is on your side.
  • It is cut off — raise data-height. The pricing table under the calculator needs the extra room.
  • Counts look wrong — confirm the data-model id actually exists in the table above; an unknown id silently falls back to GPT-4o.
  • First count is slow — the OpenAI dictionary downloads once (~2.3 MB) and is then cached in that visitor's browser.

Embed FAQ

Is the token calculator widget free to embed?

Yes. One line of HTML, free on any site including commercial ones. No API key, no account, no rate limits. The only condition is keeping the link back to tokenestimate.com.

Does the embed send visitor text to your servers?

No. Tokenization runs in the visitor's browser, and the calculator page has no backend to send anything to. Nothing is uploaded, logged or stored server-side.

Can I embed it in WordPress, Notion, Shopify or a docs site?

Use the iframe version if your platform strips third-party scripts. WordPress (custom HTML block), Shopify (page metafields or a section), Ghost and most static-site generators accept the iframe directly. Notion only accepts embeds of pages it can preview, so link to the tool instead.

How do I change which model loads first?

Set data-model="model-id" on the script tag, or ?model=model-id in the iframe URL. ids like gpt-5.5, claude-opus-5-5, gemini-3.1-pro and deepseek-v4-pro are listed above.

Can I remove the "TokenCalc" credit line?

data-credit="off" hides the text under the widget, but the embed stays free on the condition that the page links to tokenestimate.com — keep the in-widget link or add your own.

Are the token counts exact?

OpenAI models use official tiktoken, so counts match what the API bills. Other providers use a calibrated estimate accurate to roughly 5–10%, marked with an "estimate" badge inside the widget.

Does embedding slow down my page?

Barely. The iframe is loading="lazy", so nothing loads until a visitor scrolls it into view, and the tokenizer only downloads when someone actually counts text.

Want the numbers rather than the UI? The same 70-model price table is available as machine-readable JSON under CC BY 4.0: AI model pricing data →