Skip to main content

Image Aspect Ratio Calculator

Calculate the aspect ratio from pixel dimensions, derive missing dimensions from a known ratio, or generate a responsive srcset for any image size. All calculations run in your browser.

✓ Dimensions to ratio simplification ✓ Ratio to missing dimension ✓ Responsive srcset generator

Frequently Asked Questions

How do I calculate aspect ratio from pixel dimensions?▼

Divide both width and height by their Greatest Common Divisor (GCD). For 1920×1080: GCD(1920,1080) = 120, so 1920/120 = 16 and 1080/120 = 9, giving 16:9. For 1280×720: GCD = 80, so 1280/80 = 16 and 720/80 = 9 — also 16:9. The decimal ratio is simply width/height = 1.778 for 16:9.

What aspect ratio should I use for responsive web images?▼

For hero images: 16:9 (1920×1080) is the web standard. For thumbnails: 3:2 (600×400) or 4:3. For social cards (Open Graph): 1.91:1 (1200×628). For square thumbnails: 1:1. For portrait (mobile): 9:16 or 3:4. Use the srcset helper to generate all needed sizes for responsive images.

What is the padding-top trick for responsive aspect ratios in CSS?▼

Use percentage padding-top to maintain aspect ratio: for 16:9, set padding-top: 56.25% (9/16 × 100). For 4:3, use padding-top: 75%. In modern CSS, use the aspect-ratio property instead: aspect-ratio: 16/9. The padding-top trick is needed for older browser support only.

What srcset sizes should I generate for responsive images?▼

A good starting set covers the common viewport widths: 480w (mobile small), 640w (mobile standard), 768w (tablet portrait), 1024w (tablet landscape), 1280w (laptop), 1920w (desktop full HD). Add 2x versions (e.g. 960w for 480w containers) if supporting high-DPI displays. Use WebP or AVIF format for best compression at each size.

What aspect ratio is best for video thumbnails?▼

YouTube, Vimeo, and all major video platforms use 16:9 (1920x1080 or 1280x720) as the standard video thumbnail aspect ratio. Shorts/Reels use 9:16 (vertical). For custom video players on the web, 16:9 is the safe default. Never use 4:3 for new video content -- it will letterbox on widescreen displays.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →