Claude Image Too Large — Size Limits Fix (2026) | AI Error Hub
Anthropic Claude Vision Severity: Medium HTTP 400

Claude Vision — Image Too Large Error

Claude rejects images exceeding 5MB per image (base64 payload) or exceeding 8000×8000 pixels. Even smaller images cost tokens proportional to dimensions — a 1092×1092 image costs ~1600 tokens. Downscale before sending.

Error code: invalid_request_error HTTP: 400 Category: Vision Last tested: Nov 15, 2026
Quick Fix (TL;DR)

Resize images to fit within 1568px on the longest edge before uploading. This stays well under the 5MB / 8000px limits AND minimizes token cost. Use Pillow (Python) or sharp (Node) — do it client-side before base64 encoding.

The Error Messages You're Seeing

Response body
HTTP/1.1 400 Bad Request

{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "messages.0.content.0.source.data: Image exceeds 5 MB maximum. 
    Please resize or compress your image."
  }
}

Variants:
"Image dimensions exceed maximum of 8000x8000 pixels"
"Total request payload exceeds 10 MB"  ← multiple large images
"Image aspect ratio too extreme"  ← rare, >200:1

Claude's Actual Image Limits

LimitValueNotes
Max size per image (base64)5 MBEncoded size, not raw file
Max dimensions8000 × 8000 pxBoth dimensions checked
Max images per request100Rarely useful past 20
Total request payload~32 MBAll images + prompt combined
Optimal size for cost≤ 1568 px longest edge~1.6K tokens/image
Supported formatsJPEG, PNG, GIF, WebPNot: HEIC, BMP, TIFF, SVG

Token Cost by Image Dimensions

Claude tokenizes images based on tile count. Rough estimates for cost planning:

DimensionsTokensSonnet 4.5 Cost
200 × 200 (icon)~54$0.00016
512 × 512 (thumbnail)~276$0.00083
1092 × 1092 (standard)~1590$0.0048
1568 × 1568 (recommended max)~2300$0.0069
2000 × 2000 (large)~4200$0.013
4000 × 4000 (very large)~16800$0.050

What Actually Causes This Error

50%
Uploading original camera/screenshot imagesModern phone photos are 5-15 MB. Screenshots on 4K displays are 3-8 MB. Send-as-is often fails.
22%
Base64 overheadBase64 inflates size by ~33%. A 4 MB PNG becomes 5.3 MB base64 — over the limit.
15%
Multiple images in one requestIndividually OK but combined payload exceeds 32 MB request limit.
8%
Screenshots of massive documentsWhole-page PDF screenshots at high DPI hit 8000px dimension cap.
5%
Unsupported formatHEIC from iPhone, BMP from old systems. Convert to JPEG/PNG first.

Fixes That Work (Tested Nov 2026)

1Resize Before Upload (Python)

Python · Pillow resize helper
from PIL import Image import base64, io def prepare_image_for_claude(path, max_edge=1568, quality=85): """Resize + compress to fit Claude's limits and minimize tokens.""" img = Image.open(path) # Convert RGBA/CMYK to RGB for JPEG if img.mode in ("RGBA", "P", "CMYK"): img = img.convert("RGB") # Resize if longest edge exceeds max_edge if max(img.size) > max_edge: ratio = max_edge / max(img.size) new_size = (int(img.size[0] * ratio), int(img.size[1] * ratio)) img = img.resize(new_size, Image.LANCZOS) # Encode as JPEG with quality control buf = io.BytesIO() img.save(buf, format="JPEG", quality=quality, optimize=True) data = buf.getvalue() # Verify under 5 MB (base64) b64 = base64.b64encode(data).decode() if len(b64) > 5_000_000: # Recurse with more aggressive settings return prepare_image_for_claude(path, max_edge - 200, quality - 10) return b64, "image/jpeg" # Use it b64_data, media_type = prepare_image_for_claude("screenshot.png") response = client.messages.create( model="claude-sonnet-4-5", max_tokens=1024, messages=[{ "role": "user", "content": [ {"type": "image", "source": { "type": "base64", "media_type": media_type, "data": b64_data }}, {"type": "text", "text": "What's in this image?"} ] }] )

2Node.js Version with sharp

TypeScript · sharp resize
import sharp from "sharp"; async function prepareImage(path: string, maxEdge = 1568) { const buffer = await sharp(path) .resize(maxEdge, maxEdge, { fit: "inside", withoutEnlargement: true }) .jpeg({ quality: 85, mozjpeg: true }) .toBuffer(); const b64 = buffer.toString("base64"); if (b64.length > 5_000_000) { return prepareImage(path, maxEdge - 200); } return { data: b64, mediaType: "image/jpeg" }; } const { data, mediaType } = await prepareImage("screenshot.png"); const response = await client.messages.create({ model: "claude-sonnet-4-5", max_tokens: 1024, messages: [{ role: "user", content: [ { type: "image", source: { type: "base64", media_type: mediaType, data } }, { type: "text", text: "Describe this." } ] }] });

3Split Large Documents Into Regions

Instead of one huge image, send targeted crops

For long documents / whole-page screenshots, crop into meaningful regions (header, body sections, footer). Each ~1500px crop costs the same as sending one uncropped, but Claude sees each region at full detail. This works especially well for tables, forms, and scanned documents.

Python · region cropping
def split_tall_image(path, tile_h=1500, overlap=100): """Split tall screenshots into overlapping tiles.""" img = Image.open(path) tiles = [] y = 0 while y < img.height: crop = img.crop((0, y, img.width, min(y + tile_h, img.height))) buf = io.BytesIO() crop.save(buf, format="JPEG", quality=85) tiles.append(base64.b64encode(buf.getvalue()).decode()) y += tile_h - overlap return tiles content = [{"type": "text", "text": "Analyze this document (multiple tiles):"}] for tile in split_tall_image("long_page.png"): content.append({"type": "image", "source": { "type": "base64", "media_type": "image/jpeg", "data": tile }})

Preventing This Error Going Forward

  • Always resize before upload. Cap at 1568px longest edge for cost efficiency.
  • Prefer JPEG for photos, PNG for text/UI. Different compression profiles.
  • Validate media type. Convert HEIC/BMP/TIFF to JPEG before sending.
  • Set a budget per request. N images × ~2000 tokens = quick token drain.
  • For OCR tasks, don't over-downscale. Text needs enough pixels to remain legible (~800px min for small text).
SK
Tested by Sana K.
Researcher · AI Error Hub
Last verified: Nov 15, 2026 · Pillow: 10.4, sharp: 0.33

Frequently Asked Questions

Below 1092px, chart labels and small text become hard to read. For UI screenshots and photos of scenes, 1092px is fine. For text-heavy documents, 1568px is safer. Never go below 512px unless the content is simple.

Yes, use source.type: "url". Claude fetches the image. Still counts against the same 5 MB / 8000px limits — Anthropic downloads and validates. URL is not exempt from size checks.

Only the first frame is used. Animation is ignored. Large GIFs still count toward size limits. Convert to a single JPEG frame if animation adds no signal.

Not currently. Base64 encoding is required for the JSON API. This adds ~33% overhead — plan your size budget accordingly. The Files API (in beta) accepts uploads differently but has its own limits.

Anthropic doesn't publish architecture details. What matters: Claude tokenizes images into tile-based representations. Cost scales with area (tiles), not just file size. Downscaling saves tokens; compression only saves upload time.