tokcount › gpt-4o

GPT-4o token counter.

Count tokens for GPT-4o, GPT-4o mini, GPT-5, o3, and o4-mini. Free, browser-only. No API key. No signup. Exact token count using the same o200k_base encoding OpenAI charges for.

open tokcount → browser extension →
$ npm i -g @v0idd0/tokcount # one-time install $ tokcount prompt.md --model gpt-4o model: gpt-4o · encoding: o200k_base · tokens: 3,817 · cost: $0.0095 in + $0.0382 out $ tokcount context.md --model gpt-4o-mini model: gpt-4o-mini · tokens: 3,817 · cost: $0.0006 in + $0.0023 out $ tokcount prompt.md --model gpt-4o --all --tag openai # cost comparison across all OpenAI models at once 3,817 tokens · 3.0% of 128K context

OpenAI API pricing — 2026.

tokcount calculates input and output costs automatically. Cached input pricing is 50% off — use --cache flag.

GPT-4o mini

gpt-4o-mini
context: 128K · output: 16K
input$0.15 / 1M
output$0.60 / 1M
encodingo200k_base

o3

o3
context: 200K · output: 100K
input$10.00 / 1M
output$40.00 / 1M
encodingo200k_base

Pricing from OpenAI's public API docs. All models use o200k_base encoding. Exact counts — identical to tiktoken output.

Count GPT-4o tokens in the browser.

The tokcount browser extension shows live token counts as you type inside ChatGPT — including system prompt, conversation history, images, and remaining context budget before you hit the limit.

CLI — tokcount
  • exact BPE counts via o200k_base
  • multi-model cost table (--all)
  • pipe-friendly for build scripts
  • JSON output mode (--json)
Extension — live in ChatGPT
  • inline count as you type
  • context window % used
  • cost estimate per message
  • Chrome + Firefox + Edge
install tokcount extension →

GPT-4o tokenization — FAQ.

Is tokcount as accurate as tiktoken for GPT-4o?
Yes. tokcount uses gpt-tokenizer, a JavaScript port of tiktoken that produces byte-exact results for GPT-4o using the o200k_base encoding. The count you get from tokcount --model gpt-4o is identical to what OpenAI's API bills you for. This is not an estimate — it uses the same BPE vocabulary file.
What encoding does GPT-4o use?
GPT-4o uses o200k_base encoding — an updated vocabulary from the earlier cl100k_base used by GPT-4 and GPT-3.5. The main difference: o200k_base has a larger vocabulary (200,000 tokens vs 100,000) which results in slightly fewer tokens for most text, especially code and structured data.
What is GPT-4o's token and context limit?
GPT-4o has a 128,000-token context window (input + conversation history) and a 16,384-token maximum output length. o3 extends input to 200,000 tokens. tokcount warns you when your input approaches these limits and shows context utilization as a percentage.
How much does GPT-4o cost compared to GPT-4o mini?
GPT-4o costs $2.50/1M input and $10.00/1M output. GPT-4o mini costs $0.15/1M input and $0.60/1M output — roughly 17× cheaper. For a typical 4,000-token prompt + 500-token output: GPT-4o costs about $0.015; GPT-4o mini costs about $0.001. Run tokcount prompt.md --model gpt-4o --all --tag openai to see the full OpenAI cost comparison at once.
Do images count as tokens in GPT-4o?
Yes, but tokcount counts only text tokens. GPT-4o Vision bills images separately based on resolution: low-detail = 85 tokens flat; high-detail = 85 + 170 per 512×512 tile. tokcount does not include image tokens in its count — for prompts with images, add the image token estimate manually.
other model counters
Claude token counter → Gemini token counter → tokcount vs tiktoken → all 60+ models →

power user?

use tokcount daily? tools.voiddo Pro · $9 one-time

supports 67 free tools · Pro license via Paddle · one flat price, no subscription