---
title: Token Calculator | Guide to AI
description: Count LLM tokens for any text, right in your browser.
canonical: https://ai-know.org/calculator/
last-updated: 2026-09-20
site: Guide to AI (ai-know.org)
---

# Token Calculator — count LLM tokens

> Count the tokens a large language model would charge for any text. Canonical page: https://ai-know.org/calculator/

The count runs entirely in the browser using the js-tiktoken GPT-2 encoder. Text is never uploaded, logged or stored.

Language models bill and truncate by token, not by word: roughly four characters of English make one token, while Hebrew, code and rare words cost more.

## For agents

The page exposes a WebMCP tool, `count_tokens`, taking `{ "text": "…" }` and returning the token count. It is registered on the live page (see `client/src/lib/webmcp.ts` in https://github.com/LeonMelamud/AI-Knowledge); there is no server-side API to call.

---
Site index: https://ai-know.org/llms.txt
