Skip to main content

LLM Token Counter

Paste any text to count tokens and estimate API costs across GPT-4o, Claude 3.5 Sonnet, and Gemini 1.5 Pro. Uses tiktoken-style approximation — runs entirely in your browser.

✓ Runs 100% in your browser ✓ No data sent to any server ✓ No sign-up required
0 characters
🤖

GPT-4o

cl100k_base

0

tokens


Input cost

$0.000000

$5.00 / 1M input tokens

✦

Claude 3.5 Sonnet

Anthropic tokenizer

0

tokens


Input cost

$0.000000

$3.00 / 1M input tokens

💎

Gemini 1.5 Pro

SentencePiece

0

tokens


Input cost

$0.000000

$3.50 / 1M input tokens

Words: 0
Characters: 0
Lines: 0
~Reading time: 0s

⚠️ Token counts are approximations. For production billing, use the official tokenizer for each model. Prices as of Q1 2025 — check provider websites for latest rates.

Frequently Asked Questions

How does this token counter work?▼

It uses a tiktoken-style approximation: roughly 1 token per 4 characters for English text, with adjustments for whitespace, punctuation, and code. For production use cases, run tiktoken or the official tokenizer for your model.

Why do token counts differ between models?▼

GPT-4/GPT-4o uses cl100k_base, Claude uses its own tokenizer, and Gemini uses SentencePiece. All are roughly 1 token per 3-4 characters, but punctuation and special characters tokenize differently.

How is API cost estimated?▼

Input tokens use the published input price per 1M tokens; output tokens use the output price. The estimate assumes your pasted text is all input tokens. Actual costs depend on your output length.

What is a token in the context of LLMs?▼

A token is the basic unit an LLM processes — typically a word fragment, punctuation mark, or whitespace. 'tokenization' splits into 4 tokens: 'token', 'ization'. Most English words are 1-2 tokens.

Are my texts sent to any server?▼

No. All tokenization and cost calculations happen in your browser using JavaScript. Nothing is sent to any server.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

LLM Cost Calculator AI Prompt Cost Calculator AI Model Comparator Token Counter & Cost Estimator AI Hallucination Detector AI Model Comparison Tool AI Safety Checklist Generator CrewAI Agent Config Generator AI Token Cost Calculator LLM Context Window Calculator Prompt Token Estimator LLM Prompt Cost Calculator LLM JSON Schema Builder AI Agent Run Cost Tracker AWS Cost Estimator LLM Prompt Caching Calculator Jotai Atom Explorer AI Model Comparison Table LLM Prompt Template Builder CSS Container Query Builder LLM Token Counter AI Model Benchmark Comparator AI Model Context Window Visualizer AI Pipeline DAG Builder LLM Benchmark Calculator Prompt Injection Tester Vibe Coding Prompt Optimizer AI IDE Comparator AI Prompt Token Estimator LangChain PromptTemplate Builder AI Context Window Visualizer Infrastructure Cost Calculator MySQL Query Explainer PostgreSQL EXPLAIN Analyzer Cron Expression Explainer Font Pairing Preview OpenAI Token Counter AI Agent Memory Planner OpenAI Prompt Tester AI Rate Limit Calculator LLM System Prompt Analyzer Token Context Calculator RAG Chunk Size Optimizer AI API Rate Limit Calculator CI/CD Pipeline Cost Estimator AI Commit Message Generator AI Doc Generator — Pro Tool AI Regex Explainer — Pro Tool AI System Guardian Mermaid Diagram Generator Elasticsearch Query Tester mTLS Certificate Chain Builder JS Prototype Chain Visualizer System Prompt Builder RAG Chunking Calculator Smart Contract Gas Estimator AWS Lambda Cost Calculator AI Embeddings Dimension Explorer Multi-Agent Orchestration Planner OpenAI Function Calling Generator Embedding Storage Calculator Blockchain Transaction Fee Calculator HTTP Headers Analyzer AI Code Review — Pro Tool AI Error Explainer — Pro Tool AI SQL Builder — Pro Tool AI Unit Test Generator — Pro Tool Color Palette Generator Docker Compose Generator JWT Decoder Prompt Template Builder Regex Tester RSA Key Pair Generator SMTP Server Tester Biome Config Generator Terraform Variable Validator Haproxy Config Validator SBOM Generator AI Variable Namer AI PR Description Generator AI JSDoc Generator K8s Resource Limits Calculator Regex Flags Explainer Kubernetes Resource Calculator OAuth2 Flow Visualizer Playwright E2E Testing Guide Core Web Vitals Calculator MCP Endpoint Tester Solana Program ID Generator Multi-Chain Wallet Address Validator MCP Server Config Builder RAG Chunking Calculator TypeScript Discriminated Union Builder Core Web Vitals Budget Calculator JWT Decoder & Validator Database Query Cost Analyzer

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →