How do I calculate aspect ratio from width and height?
Enter the width and height in pixels and this calculator instantly shows the simplified ratio (e.g., 16:9), decimal value, CSS aspect-ratio property, visual preview, and a table of equivalent sizes at common resolutions. Use the Resize tab to scale dimensions while preserving proportions, or browse Device Presets for phones, tablets, monitors, and social media formats. Everything runs in your browser — no signup required.
Width: 1920 Height: 1080
Aspect Ratio: 16:9 Decimal: 1.778 CSS: aspect-ratio: 16 / 9; Common name: Full HD / Widescreen
Aspect Ratio Calculator
Calculate, convert, and resize aspect ratios for images, video, and responsive design.
Enter Dimensions
Result
aspect-ratio: 16 / 9;Common Aspect Ratios
Equivalent Sizes at 16:9
| Width | Height | Pixels | Label |
|---|---|---|---|
| 320 | 180 | 0.1 MP | |
| 480 | 270 | 0.1 MP | |
| 640 | 360 | 0.2 MP | |
| 768 | 432 | 0.3 MP | |
| 960 | 540 | 0.5 MP | |
| 1024 | 576 | 0.6 MP | |
| 1280 | 720 | 0.9 MP | 720p / HD |
| 1440 | 810 | 1.2 MP | |
| 1600 | 900 | 1.4 MP | |
| 1920 | 1080 | 2.1 MP | 1080p / Full HD |
| 2560 | 1440 | 3.7 MP | 1440p / 2K |
| 3840 | 2160 | 8.3 MP | 2160p / 4K UHD |
Tips & Best Practices
Use CSS aspect-ratio property instead of the padding-top hack
The old trick of `padding-top: 56.25%` for 16:9 is no longer needed. CSS `aspect-ratio: 16/9` does the same thing with clearer intent and works on any element. Browser support is universal since 2022.
Aspect ratio changes when you add borders or padding
With `box-sizing: content-box` (default), padding and borders are added outside the content area, changing the effective aspect ratio. Always use `box-sizing: border-box` with aspect-ratio to ensure the ratio includes padding and borders.
Common aspect ratios: 16:9 (video), 4:3 (photos), 1:1 (social avatars)
YouTube/Vimeo embeds: 16:9. Instagram posts: 1:1 or 4:5. Twitter/X images: 16:9 or 2:1. Blog hero images: typically 2:1 or 21:9. Knowing these standards helps you create images that display without cropping on each platform.
Validate image dimensions server-side to prevent memory exhaustion
An attacker could upload a 50000x50000px image that's only 1MB compressed but requires 10GB of memory when decompressed. Always validate image dimensions server-side and reject images exceeding reasonable limits for your use case.
Frequently Asked Questions
How do I calculate the aspect ratio of an image?
What is the most common aspect ratio for video?
How do I resize an image without stretching it?
What does the CSS aspect-ratio property do?
Related Inspect Tools
Code Complexity Analyzer
Analyze JavaScript and TypeScript code for cyclomatic complexity, cognitive complexity, nesting depth, and maintainability index with per-function metrics
GitHub Actions Validator
Validate GitHub Actions workflow YAML files for syntax, triggers, job structure, step config, needs dependencies, and deprecated actions
XPath Tester
Test XPath expressions against XML data with real-time evaluation — select elements, filter by attributes, navigate axes, and use XPath functions
SQL Playground
Run SQL queries in your browser with a full SQLite database powered by WebAssembly — practice JOINs, CTEs, window functions, aggregations, and more