Skip to content

Git Diff Token Counter

Paste a git diff and see token counts per file, cost across AI models for code review, and chunking suggestions when diffs exceed context limits.

Git Diff Token Counter

702 tokens across 3 files

Tokens
702
Files
3
Added
+60
Removed
-8

Per-file breakdown

File+-Tokens%
src/hooks/useAuth.ts+29-024034.2%
src/components/Button.tsx+11-523132.9%
src/utils/format.ts+20-323132.9%

Cost estimates (input)

ModelCostFits?
claude-fable-5-1$0.0070Fits in context window
claude-opus-5-5$0.0028Fits in context window
claude-sonnet-5-5$0.0014Fits in context window
claude-haiku-4-5$0.0007Fits in context window
gpt-6-astra$0.0070Fits in context window
gpt-6.1-sol$0.0014Fits in context window
gpt-6-luna$0.0000Fits in context window
gpt-5.5$0.0035Fits in context window
gpt-5.4-mini$0.0005Fits in context window
gemini-3.8-flash$0.0005Fits in context window
gemini-3.5-flash-lite$0.0002Fits in context window
gemini-3.1-pro-preview$0.0014Fits in context window
deepseek-flash$0.0002Fits in context window
deepseek-v4-pro$0.0009Fits in context window
grok-4.7$0.0014Fits in context window
grok-4.3$0.0009Fits in context window
mistral-medium-3504$0.0011Fits in context window
mistral-small-2603$0.0001Fits in context window
mistral-large-2512$0.0004Fits in context window
muse-spark-1.3$0.0009Fits in context window
qwen3.8-max$0.0014Fits in context window
qwen3.8-flash$0.0001Fits in context window
openai/gpt-oss-120b$0.0001Fits in context window

With system prompt overhead (~2,000 tokens), actual cost is slightly higher. Token counts use a chars/4 heuristic; actual tokenization varies by model. Prices are input-only (the diff is sent as input).

What this tool does

Paste a git diff into the Git Diff Token Counter to see token counts per file and the estimated cost of an AI code review across GPT, Claude, and other models. When a diff is larger than a model's context window, it suggests where to chunk it so large reviews still fit. It runs privately in your browser.

Updated . Provided as is. Check the output before you rely on it in production.

How to use Git Diff Token Counter

  1. 1

    Paste your git diff

    Run git diff in your terminal and paste the output. The tool parses unified diff format and extracts per-file changes.

  2. 2

    Review per-file breakdown

    See each modified file with its addition and deletion counts, token count, and percentage of the total diff. Files are sorted by token count.

  3. 3

    Check model costs

    The cost table shows what it would cost to send this diff to various AI models for code review, with context-fit indicators showing which models can handle the full diff.

  4. 4

    Apply chunking suggestions

    If your diff exceeds any model's context window, the tool suggests how to split files into groups that each fit within the limit for multi-pass review.

Questions and answers

What is Git Diff Token Counter?
A git diff is the unified-format patch of what changed between two versions, and sending it to a model for review costs tokens like any prompt. This counter parses the diff per file, estimates tokens at four characters each, prices the input on current models and splits files into chunks that fit each context window.
How accurate are the token estimates?
Token counts use a chars/4 heuristic that closely approximates most tokenizers. For exact counts, use a model-specific tokenizer, but this estimate is reliable for cost planning.
Does it send my code diffs to a server?
No. All parsing happens entirely in your browser. Your code changes never leave your device.
What is chunking and when do I need it?
When a diff exceeds a model's context window, the tool suggests splitting files into groups that each fit within the limit. This lets you send the diff for AI review in multiple passes.
For AI agents: how to call this tool

Machine-readable contract, endpoints and examples. Humans can ignore this section.

Best Path For Builders

Browser workflow

Runs instantly in the browser with private local processing and copy/export-ready output.

Browser Workflow

This tool is optimized for instant in-browser execution with local data handling. Run it here and copy/export the output directly.

/git-diff-token-counter/

For automation planning, fetch the canonical contract at /api/tool/git-diff-token-counter.json.