Google Gemini 3.6 Flash · Official countTokens

Gemini 3.6 Flash Token Counter

Use Google's model-aware countTokens method before generation to measure Gemini 3.6 Flash input. The local explorer is not the Gemini tokenizer.

Accuracy note

API counting required. Google models.countTokens with model gemini-3.6-flash is authoritative for preflight input counting; final interaction usage includes additional categories.

Model ID
gemini-3.6-flash
Input limit
1,048,576 tokens
Output limit
65,536 tokens
Exact method
models.countTokens

Facts checked against official sources on .

How to Count Gemini 3.6 Flash Tokens

Call models.countTokens with model gemini-3.6-flash and the same contents you plan to send. The method runs the model's tokenizer and returns the total number of input tokens without generating a response.

For a completed interaction, inspect its usage object. Google separates input, output, thought, cached, tool-use, and total tokens, so a preflight text count and the final interaction total answer different questions.

javascriptOfficial counting example
import { GoogleGenAI } from "@google/genai";

const client = new GoogleGenAI({});
const result = await client.models.countTokens({
  model: "gemini-3.6-flash",
  contents: "Count this Gemini 3.6 Flash prompt.",
});
console.log(result.totalTokens);

What Gemini countTokens Can Measure

Input typeCount before generation?Important note
Text and chat historyYesSend the complete contents structure
Images and documentsYesMedia follows Gemini-specific token accounting
Audio and videoYesDuration and media processing affect the total
System instructions and toolsYesInclude the same configuration as the real request
Generated output and thinkingNoRead these from final interaction usage

Gemini 3.6 Flash Context Planning

Google documents a 1,048,576-token input limit and a 65,536-token output limit for the current Flash generation. Do not fill the input allowance without considering files, system instructions, tool definitions, conversation state, and the output your workflow needs.

The Gemini 3.5 Flash page remains useful for applications pinned to that stable model. Use this Gemini 3.6 page only when the request model is gemini-3.6-flash, because model updates can change tokenization and usage behavior.

Tiktokenizer Reference Sources

Tokenizer behavior and model limits change. Verify production decisions with current provider documentation:

Frequently asked questions

How do I count Gemini 3.6 Flash tokens exactly?

Call models.countTokens with model gemini-3.6-flash and the same contents structure you plan to use.

Is the local browser result a Gemini count?

No. The browser explorer is comparison-only because Gemini uses Google's model-aware tokenizer.

Does countTokens include output tokens?

No. It is a preflight input count. Read output, thought, cache, tool-use, and total token categories from the final interaction usage.

What are the Gemini 3.6 Flash token limits?

Google documents an input limit of 1,048,576 tokens and an output limit of 65,536 tokens.