Paste a prompt to count its tokens for GPT-5, GPT-4.1, GPT-4o, the o reasoning models, GPT-4 and embedding models, then estimate the cost with your model's price.
GPT-5, GPT-4.1, GPT-4o, GPT-4o mini, o4-mini, o3, o1, o1-mini
o200k_base
GPT-4 Turbo, GPT-4, GPT-3.5 Turbo, text-embedding-3-large, text-embedding-3-small, text-embedding-ada-002
cl100k_base
GPT-2
gpt2
Enter your model's price per 1M input tokens from the OpenAI pricing page.
Step-by-step guide
Paste your text into the token counter above. It splits the text the same way OpenAI models do and shows the token count for each model family. In English, one token is about four characters, or about three quarters of a word, but the exact count depends on the model's encoding.
Include the instructions and examples you send to the model, not only the question, because every part counts. The API also adds a few tokens per chat message for formatting.
GPT-5, GPT-4.1, GPT-4o and the o-series reasoning models use the o200k_base encoding. GPT-4, GPT-3.5 Turbo and the embedding models use cl100k_base.
Enter your model's price per 1M input tokens. The cost is the token count divided by 1,000,000, times the price. Output tokens are billed separately, at their own price.
Remove repeated instructions and long examples, and send only the part of a document the model needs. Then count again.
Hello, world!
4 tokens with o200k_base and cl100k_base (13 characters)
Photosynthesis happens in the chloroplasts.
9 tokens (43 characters, 5 words)
¿Dónde está la biblioteca?
6 tokens with o200k_base, 9 with cl100k_base: newer encodings often need fewer tokens for languages other than English
https://www.quizrise.com/token-counter
8 tokens: links and code split into many small pieces
With the advance of artificial intelligence technologies comes the need for precise cost prediction tools. Our Free Token Calculator for the OpenAI API helps estimate your usage costs with accuracy. This tool provides a clear picture of expenses when utilizing models like GPT-5, GPT-4.1, GPT-4o, GPT-4o Mini, o1, o3 reasoning models, GPT-4 Turbo, GPT-3.5 Turbo, and embedding models such as text-embedding-3-large, text-embedding-3-small and text-embedding-ada-002. The calculator assists in monitoring your expenditure by analyzing the tokens used in API calls based on different model encodings. Decipher the OpenAI API cost with this free token pricing calculator and effectively leverage the power of AI without unplanned expenses.
The Token Calculator is an innovative tool allowing you to estimate token costs. Utilizing OpenAI's `tiktoken` library, this calculator evaluates the number of tokens in a text string for various models, giving you a clear idea of your consumption. This is crucial for API usage, where token count significantly impacts your bill. It facilitates budgetary management for developers, offering a better understanding of usage patterns and costs across different models like GPT-4o, GPT-4o Mini, o1, o3 reasoning models, GPT-4, and GPT-3.5 Turbo. Calculating tokens helps maintain cost efficiency while enabling optimal resource utilization.
Our integral token counter assists users in optimizing OpenAI costs. Counting tokens helps control text length and forecast usage across different models, ensuring you stay within specific utilization constraints. This forecasting ability is crucial for managing OpenAI billing effectively. Understanding how tokens are counted provides greater visibility into usage and helps minimize unnecessary costs. Improper token management can lead to higher expenses, making the token counter an indispensable tool for cost-efficient usage of OpenAI's language and embedding model services.
To calculate token usage with our tool, simply input your text. It utilizes the `tiktoken` library to determine the token count based on each model's encoding (e.g., `o200k_base` for GPT-5 and GPT-4o, `cl100k_base` for GPT-4/GPT-3.5 Turbo, `r50k_base`/`gpt2` for older models). Remember that a token isn't always a full word; it can be part of a word, a punctuation mark, or whitespace. By seeing how different models tokenize your text, you can better estimate potential API costs and optimize your prompts for efficiency.
An OpenAI token is the fundamental unit of text or code processed by models like GPT-4o, GPT-4, GPT-3.5-turbo, and embedding models. The cost of using these models via the API depends directly on the number of tokens in your input (prompt) and the model's output (completion). While more tokens can allow for more complex instructions or detailed responses, it also increases computational cost. Roughly, 1,000 tokens equate to about 750 English words, but this varies. Understanding tokens is key to managing API costs.
OpenAI uses Byte Pair Encoding (BPE) via the `tiktoken` library to convert text into tokens. Different models use different BPE encodings, affecting the token count for the same text:
A token can be a word, part of a word (e.g., "calcul" and "ator"), a single character, punctuation, or whitespace. Even a space before a word often forms part of a token (e.g., " hello"). Our calculator shows how your text breaks down for each encoding.
Optimizing API usage costs involves several strategies focused on token efficiency:
Using our Token Calculator helps you experiment with prompt changes and understand their token impact before incurring API costs.
You can review how much you use in the
OpenAI dashboard usage section.
In the
OpenAI dashboard billing section, you can quickly create spending limitations.