Image Handling

How Mastodon processes, resizes, and displays preview card images

Aspect ratio determines card layout

Mastodon doesn’t use a meta tag to choose the card format. The image aspect ratio controls everything:

  • Landscape (width > height): large card with a full-width image at 1.91:1
  • Portrait or square (width <= height): small card with a 120px thumbnail to the right of the text

twitter:card is completely ignored. If you want a large card on Mastodon, your image must be wider than it is tall. No exceptions.

Recommended image dimensions

1200 x 630 pixels (1.91:1) works across Mastodon and most other platforms. The real requirement is just that width exceeds height; even 640 x 360 triggers the large layout.

Image processing

Mastodon scales all preview card images down to a target of 230,400 pixels (roughly 640 x 360). There’s no benefit to a 4000px-wide source image, since it gets resized regardless.

A blurhash placeholder is generated for each image, showing a blurred color preview while the full image loads.

Size and format limits

  • Maximum file size: 8 MB
  • Supported formats: JPEG, PNG, GIF, WebP
  • GIF handling: animated GIFs are converted to static JPEG (first frame only)

Images over 8 MB are silently dropped. The card falls back to text-only.

Image URL requirements

The og:image URL must be:

  • An absolute URL (not a relative path)
  • Accessible without authentication
  • Served with a valid image Content-Type header
  • Reachable within the instance’s 30-second total timeout

HTTPS is strongly recommended. Many instances reject non-HTTPS resources outright.