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.
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
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
| Limit | Value | Notes |
|---|---|---|
| Max size per image (base64) | 5 MB | Encoded size, not raw file |
| Max dimensions | 8000 × 8000 px | Both dimensions checked |
| Max images per request | 100 | Rarely useful past 20 |
| Total request payload | ~32 MB | All images + prompt combined |
| Optimal size for cost | ≤ 1568 px longest edge | ~1.6K tokens/image |
| Supported formats | JPEG, PNG, GIF, WebP | Not: HEIC, BMP, TIFF, SVG |
Token Cost by Image Dimensions
Claude tokenizes images based on tile count. Rough estimates for cost planning:
| Dimensions | Tokens | Sonnet 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
Fixes That Work (Tested Nov 2026)
1Resize Before Upload (Python)
2Node.js Version with sharp
3Split Large Documents Into Regions
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.
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).
Researcher · AI Error Hub
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.
Related Errors
Master Claude Vision
Weekly deep dives on vision pipelines, OCR patterns, and cost optimization. 12,000+ developers subscribe.
Subscribe Free →