TToolbox
16:9

Aspect Ratio Calculator

Scale dimensions and keep the ratio

About this tool

Aspect ratio describes the proportional relationship between the width and height of an image, video display, or UI viewport. Whether editing traditional 16:9 widescreen footage, framing 9:16 vertical TikToks, or designing responsive CSS containers, scaling dimensions while preserving original geometry prevents letterboxing, pillarboxing, and stretched distortion. This tool provides bidirectional aspect ratio scaling, greatest common divisor (GCD) simplification, and common screen presets.

How to Use This Tool (Step-by-Step)

1

Enter Base Ratio or Dimensions

Enter your original width and height in pixels (e.g., 1920x1080), or select from standard presets (16:9, 4:3, 1:1, 21:9, 9:16).

2

Specify New Width or Height

Input your target new width (or height). The calculator locks proportional constraints to compute the exact opposite dimension.

3

Copy Dimension or CSS Rule

Inspect real-time dimension metrics and copy pixel values or modern CSS `aspect-ratio: 16 / 9;` declarations directly.

Automatic GCD Ratio Simplification

Automatically calculates greatest common divisors (GCD) to reduce arbitrary pixel resolutions (2560x1440) to standard ratios (16:9).

Bidirectional Aspect Locking

Seamlessly derives height from width, or width from height, eliminating manual cross-multiplication algebra errors.

100% Client-Side Air-Gapped

Mathematical operations compute entirely inside your local browser memory with zero network latency and no intrusive ads.

Letterboxing Prevention & Design Best Practices

  • •Prevent letterboxing and pillarboxing: Mismatched video and player ratios cause black border padding. Match source and container ratios for flush playback.
  • •Always use `object-fit: cover`: Setting conflicting width and height squashes image subjects. `object-fit: cover` crops safely while maintaining aspect geometry.
  • •Ensure even pixel dimensions for video codecs: H.264/H.265 encoders mandate even width and height pixels (macroblocks of 2 or 8). Always round odd numbers up.

Code & Transformation Examples

Industry Standard Aspect Ratio Resolution Benchmark

Standard Aspect Ratios
• 16:9  (宽屏经典) : 1920×1080 (1080P), 2560×1440 (2K), 3840×2160 (4K)
• 9:16  (竖屏短视频) : 1080×1920 (抖音 / TikTok / 微信视频号)
• 4:3   (传统标清) : 1024×768, 800×600 (iPad 传统屏幕、老式电视)
• 1:1   (正方形)   : 1080×1080 (Instagram / 电商主图展示)
• 21:9  (电影带鱼屏): 3440×1440 (宽银幕影院大片)
Cross-Multiplication Formula
已知比例 W:H 与新宽度 W2,求新高度 H2:
H2 = (W2 * H) / W
例如 16:9 下宽度缩至 1280:
H2 = (1280 * 9) / 16 = 720 像素

* Modern display devices universally standardize on square pixel aspect ratios (PAR 1:1).

Modern CSS aspect-ratio Property Snippet

Modern CSS Syntax
.video-container {
  width: 100%;
  aspect-ratio: 16 / 9; /* 强制锁定 16:9 比例 */
  object-fit: cover;
}
Core Web Vitals Benefit
在图片和视频尚未下载完成前,浏览器就能依据 aspect-ratio 提前占位对应物理高度,彻底杜绝导致 CLS(累计布局偏移)分数飘红的页面跳动!

* `aspect-ratio` is supported in all modern browsers, completely obsoleting the legacy padding-top hack.

Frequently Asked Questions

Q: Why is 16:9 represented as 1.7777... as a decimal?

A: Dividing 16 by 9 yields ~1.7778. Cinema and broadcast standards conventionally represent 16:9 as '1.78:1' and ultrawide 21:9 as '2.39:1'.

Q: What is GCD and why is it used for aspect ratios?

A: GCD is the largest shared integer factor. The GCD of 1920 and 1080 is 120. Dividing both by 120 simplifies the resolution directly into its lowest terms: 16:9.

Q: What is the optimal resolution for vertical mobile video?

A: The universal mobile standard is `1080 × 1920` (9:16 vertical full HD). It matches modern smartphone displays natively without unnecessary bandwidth overhead.

Related Tools

All processing happens locally in your browser. Your data is never uploaded to a server.
/