esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
Let’s talk

I’ll build the agent for it.

How Do Images Become Tokens?

How a photo is cut into patches, turned into vectors and counted as tokens, and why big pictures cost more, explained for your AI interview.

In short

An image has no words, so the model cuts it into small squares called patches and turns each one into a vector it can read. Anthropic counts each 28 by 28 pixel patch as one visual token, so bigger pictures cost more.

12 min readIntermediateCommon · estimateFacts checked 27 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

An image has no words, so the model cuts it into small squares called patches. Each square becomes a vector, a list of numbers the model can read, and people call that a visual token. Anthropic's docs say each patch covers 28 by 28 pixels, so bigger pictures cost more. Before I send a screenshot, I shrink it to the smallest size that still keeps the small text readable.

What are image tokens, in plain words?

A language model works on numbers. Text is cut into tokens, small chunks of text that are often part of a word, and each token becomes a vector, a list of numbers that stands for it. A picture has no words, so it needs its own route into those vectors.

The usual route is to cut the picture into a grid of small squares, called patches. Each square is flattened into a list of pixel values, and a learned step (numbers the model tunes during training) turns that list into a vector. People call each of these image vectors a visual token.

Think of a claims adjuster who cuts a crash photo into numbered squares, logs what is in each one, and notes where it sat on the page. A claims app does the same with a photo of a dented bumper. The model gets a row of square vectors, each tagged with its position, and reads them beside the policy wording.

Key words

Patch
A small square cut from the picture. Anthropic's docs use 28 by 28 pixels.
Visual token
One patch, turned into a vector the model reads next to the text.
Patch embedding
The vector a learned map makes from one flattened patch.
Position embedding
A tag added to each vector that says where its square sat.
Downscale
Shrinking a picture that is bigger than the model's limit, before it is read.

How does a picture become a sequence of vectors?

The Vision Transformer paper from 2020, known as ViT, set out the basic recipe. A transformer is the model design behind modern chatbots, and ViT applies it to squares of a picture. Its abstract says that "a pure transformer applied directly to sequences of image patches can perform very well on image classification tasks". Its figure caption gives the steps in one line:

  • “We split an image into fixed-size patches, linearly embed each of them, add position embeddings, and feed the resulting sequence of vectors to a standard Transformer encoder.”

    ViT paper, 2020

  1. 1

    Cut the picture into squares

    The paper's title, "An Image is Worth 16x16 Words", hints at 16 by 16 patches. Anthropic's current docs use 28 by 28, so the size is a design choice.

  2. 2

    Flatten each square

    Each square is unrolled into one long list of numbers, one for each colour value in the square.

  3. 3

    Map each list to a vector

    A learned step, a simple multiply-and-add, turns each list into a vector of the size the model uses. The paper calls these the patch embeddings.

  4. 4

    Add a position tag

    Position embeddings are added so the model can tell where each patch sat. Without them, the model would not know which square sat where.

From a photo to tokens

Photo or screenshot

a grid of coloured pixels

Cut and flatten

Cut into squares

one square per visual token

Flatten to numbers

every colour value in the square

Patch to vector

learned map plus a position tag

Model

reads them beside the text

Answer

ordinary text about the picture

  1. 1The picture goes in as a grid of coloured pixels.
  2. 2Each square is flattened into one long list of numbers.
  3. 3A learned map turns each list into a vector, with a position tag.
  4. 4The model reads these vectors in the same run as the text.
  5. 5It writes its answer as ordinary text.
A photo is cut into squares, each square is turned into numbers and then into a vector, and the model reads those vectors beside the text. The position tag tells the model where each square sat. The answer comes back as ordinary text.

The model then reads these vectors in the same run as the text, so the picture takes room from the same context window (the total text and images the model can read in one go). An example is LLaVA, a 2023 paper. It describes an "end-to-end trained large multimodal model that connects a vision encoder and LLM". Here multimodal means it handles pictures and text, and LLM means a large language model. Its authors say the model and code are publicly available.

How many tokens does one picture cost?

Cost follows pixel size. What the picture shows does not change the count. Anthropic's docs give the rule: each patch covers 28 by 28 pixels, so the grid is the width divided by 28, rounded up, times the height divided by 28, rounded up. Each patch in that grid is one visual token.

  • “Claude processes images in patches instead of pixels.”

    Anthropic

  • “keep in mind that images count as tokens and will be billed accordingly.”

    OpenAI

Here is the rule in plain Python, with the two sizes from Anthropic's table.

Python
# Visual tokens for a picture: one 28 x 28 patch per token, rounded up at the edges.
import math

PATCH = 28

def visual_tokens(width, height):
    return math.ceil(width / PATCH) * math.ceil(height / PATCH)

# The model sees these sizes: the standard tier shrinks the screenshot first.
standard = visual_tokens(1456, 819)
high_res = visual_tokens(1920, 1080)

print("Standard tier, shrunk to 1456 x 819:", standard, "tokens")
print("High-res tier, kept at 1920 x 1080:", high_res, "tokens")
print("High-res costs", round(high_res / standard, 1), "times as much")

Output

Standard tier, shrunk to 1456 x 819: 1560 tokens
High-res tier, kept at 1920 x 1080: 2691 tokens
High-res costs 1.7 times as much

A claims team sends a 1,920 by 1,080 pixel screenshot of a crash report. Anthropic calls these size settings tiers. Claude 4.7 and later models use the high-resolution tier, and all other models use the standard tier. Here is the same screen on each tier. On the standard tier the model shrinks it to 1,456 by 819 first, which costs 1,560 visual tokens. Kept whole on the high-resolution tier, it costs 2,691. That is about 1.7 times as many tokens for the same screen.

One screenshot, two sizes

High-resolution tier

1920 x 1080 screenshot

69 by 39 patches

Standard tier

Resized to 1456 x 819

52 by 30 patches

2,691 tokens

fine detail, higher cost

1,560 tokens

cheaper, small text may blur

  1. 1Kept whole, the grid is 69 by 39 patches, so 2,691 tokens.
  2. 2Shrunk first, the grid is 52 by 30 patches, so 1,560 tokens.
The same screenshot, two ways. Keeping it whole on the high-resolution tier gives more patches and more tokens, so fine detail costs more. The standard tier costs less, but the fine print may blur.

What does shrinking a picture cost you?

Shrinking saves tokens, and the price is detail. Anthropic's guidance says a resize "might, for example, make text less legible", so a shrunk policy number can turn into a guess. High-resolution images can also use up to roughly three times more visual tokens than the same image on a standard tier, so the extra detail has a price.

  • Crop to the part that matters

    Send the damaged panel and the plate, not the whole street, so every token carries a useful detail.

  • Test the smallest readable size

    Try the real page or the real form at two or three sizes, and check that the policy number still reads.

  • Pay for the high tier only where it earns it

    Dense forms and small print can justify the extra tokens. A photo of a bumper usually does not need them.

Tip

OpenAI's guide warns that a low detail setting does not always save tokens, so measure the count for your model instead of assuming.

How would you cut the cost of a claims app that reads photos?

A claims app sends the photo again on every turn of the chat, because each request resends the earlier messages and images. Each resend counts toward that request's tokens, so the cost builds up over a long claim.

  1. 1

    Measure before you change anything

    Count the tokens for a typical claim photo with the width and height rule. Put a number on the problem first.

  2. 2

    Shrink to the smallest safe size

    Resize to the least size that still reads the policy number and the plate. Check it with real photos from the field, not clean test shots.

  3. 3

    Stop resending the photo

    Once the adjuster has the facts, a short written summary can stand in for the photo in later requests. The Files API keeps request payloads small, but the image still counts toward tokens.

  4. 4

    Track tokens per claim

    Log the token count for each claim, so one long chat with many photos shows up in the numbers.

What does the interviewer want to hear?

A strong answer covers

  • Patches: the picture is cut into squares, and each square becomes a vector.
  • Cost: width and height in 28 pixel steps, each rounded up, then multiplied.
  • Shrinking saves tokens, but small text can blur.
  • Limits and tiers differ by model, so check the current docs.
  • Images share the context window with the text.
  • A visual token here is a vector made from a patch, not an id from the text vocabulary.

Common traps

  • Trap"An image is just a file, so the model reads it like text."

    BetterIt is cut into patches, and each patch becomes a vector the model reads next to the text.

  • Trap"Bigger pictures always give better answers."

    BetterDetail helps only up to the model's limit. Past it, the picture is shrunk anyway, so send the size that keeps the text readable.

  • Trap"A photo of a contract costs more tokens than a blank wall."

    BetterAt the same size they cost the same. Cost follows the pixels.

Can you spot the wrong count?

Spot the wrong count

Your team estimates the cost of a claims photo with Anthropic's rule. Which line counts its visual tokens correctly?

Quick check

A 1,920 by 1,080 screenshot goes to the standard tier, which shrinks it to 1,456 by 819. How many visual tokens does that cost?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q443What is CLIP?11 min
  2. Q072What is a vision transformer?11 min
  3. Q448How do you extract structured data from documents and images?12 min
  4. Q452Native multimodal vs pipeline approach?12 min
  5. Q040How do you estimate the token count of a text?10 min

Learn it in depth

Last updated on 27 November 2026

Building an app that reads photos or scans?

Venkat designs and builds AI products and agents (the UI and the system behind it), so book a short call and say what you need.