DEV Community

Dev Nestio
Dev Nestio

Posted on

I built an Aspect Ratio Calculator — resize dimensions, simplify ratios, explore common ratios

What I built

I added an Aspect Ratio Calculator to devnestio — a free dev tools collection.

👉 https://devnestio.pages.dev/aspect-ratio-calculator/

Calculate aspect ratios from any WxH dimensions, resize while preserving ratio, and explore 12 common ratios (16:9, 4:3, 1:1, etc.) — all in-browser.

Why I built it

Resizing images, calculating embed dimensions, setting aspect-ratio in CSS — I kept doing the same mental math. A dedicated tool is faster and less error-prone.

Features

  • Ratio from dimensions — input WxH, get simplified ratio (via GCD), decimal, percentage, and closest common ratio
  • Resize preserving ratio — lock width or height, or specify a ratio and one dimension
  • Visual preview — box shaped to the exact ratio you entered
  • 12 common ratio chips — 16:9, 4:3, 1:1, 21:9, 3:2, 9:16, 4:5, 16:10, and more
  • Copy buttons — grab computed values instantly

Examples

Input Simplified Ratio Decimal
1920 x 1080 16:9 1.7778
1024 x 768 4:3 1.3333
800 x 200 4:1 4.0000

Tech

Single HTML file, zero dependencies, GCD-based ratio simplification, hosted on Cloudflare Pages.


Part of devnestio — a growing collection of free, in-browser developer tools.

Top comments (0)