VMin & VMax Converters

Convert CSS Viewport Minimum (vmin) & Maximum (vmax) units to pixels across custom screen geometries

VMin & VMax Converters

Viewport Widthpx
Viewport Heightpx
VMin (smaller side):1080px
VMax (larger side):1920px
Aspect Ratio:1920:1080 (1.78:1)
VMin → PX
px1vmin = 10.8px
VMax → PX
px1vmax = 19.2px
PX → VMin
vmin1px = 0.0926vmin
PX → VMax
vmax1px = 0.0521vmax
Common Viewport Sizes:

Understanding VMin and VMax Units

VMin (viewport minimum) and VMax (viewport maximum) are CSS viewport-relative units that adapt based on the smaller or larger dimension of the viewport, making them incredibly useful for responsive design.

// VMin and VMax definitions
1vmin = 1% of viewport's smaller dimension
1vmax = 1% of viewport's larger dimension

// Example: Viewport 1920×1080px (landscape)
Smaller dimension: 1080px (height)
Larger dimension: 1920px (width)
1vmin = 1% of 1080px = 10.8px
1vmax = 1% of 1920px = 19.2px

When to Use VMin vs VMax

UnitBest ForUse Case ExampleBehavior on RotationTypical Values
VMinElements that should scale with smaller dimensionFont sizes, icons, buttons on mobileChanges when device rotates2vmin-10vmin
VMaxElements that should scale with larger dimensionContainers, hero sections, full-width elementsStays consistent on rotation50vmax-100vmax
VWWidth-specific scalingHorizontal layouts, sidebarsChanges on width resize only25vw-100vw
VHHeight-specific scalingFull-screen sections, vertical spacingChanges on height resize only50vh-100vh

Conversion Formulas

// Conversion formulas
VMin to Pixels: px = (vmin ÷ 100) × min(width, height)
VMax to Pixels: px = (vmax ÷ 100) × max(width, height)
Pixels to VMin: vmin = (px ÷ min(width, height)) × 100
Pixels to VMax: vmax = (px ÷ max(width, height)) × 100

// Example calculations for 1920×1080 viewport
10vmin to px: (10 ÷ 100) × 1080 = 108px
10vmax to px: (10 ÷ 100) × 1920 = 192px
200px to vmin: (200 ÷ 1080) × 100 = 18.52vmin
200px to vmax: (200 ÷ 1920) × 100 = 10.42vmax

Practical Applications

Responsive Typography with VMin

Text that scales with smaller dimension:

font-size: 4vmin;
• On mobile portrait: 4% of width
• On mobile landscape: 4% of height
• Always readable on any orientation
Perfect Circles with VMin

Create circles that stay circular on rotation:

.circle {
  width: 50vmin;
  height: 50vmin;
  border-radius: 50%;
}

CSS Implementation Examples

// Responsive font sizing that works on all devices
.responsive-heading {
  font-size: clamp(1.5rem, 5vmin, 3rem);
  /* Scales with smaller dimension, with min/max limits */
}

// Full-screen hero section that adapts to orientation
.hero-section {
  width: 100vmax;
  height: 100vmin;
  background: linear-gradient(45deg, #667eea, #764ba2);
}

// Responsive spacing system
:root {
  --space-unit: 2vmin;
  --space-sm: calc(var(--space-unit) * 0.5);
  --space-md: var(--space-unit);
  --space-lg: calc(var(--space-unit) * 2);
  --space-xl: calc(var(--space-unit) * 4);
}

// Aspect ratio containers
.square-container {
  width: 80vmin;
  height: 80vmin;
  max-width: 500px;
  max-height: 500px;
}

Device Rotation Behavior

// How units behave on device rotation (example: 375×667 mobile)
Portrait Orientation:
  Width: 375px, Height: 667px
  Smaller dimension: 375px (width)
  Larger dimension: 667px (height)
  10vmin = 37.5px (10% of 375px)
  10vmax = 66.7px (10% of 667px)

Landscape Orientation:
  Width: 667px, Height: 375px
  Smaller dimension: 375px (height)
  Larger dimension: 667px (width)
  10vmin = 37.5px (10% of 375px)
  10vmax = 66.7px (10% of 667px)

Key Insight: vmin stays consistent (37.5px), vmax stays consistent (66.7px)
Result: Elements sized with vmin maintain size on rotation

Best Practices

  • Use vmin for typography to ensure readability on all orientations
  • Use vmax for full-width/full-height elements
  • Combine with clamp() to set minimum and maximum boundaries
  • Test on both portrait and landscape orientations
  • Consider accessibility - ensure text doesn't become too small
  • Use CSS custom properties for maintainable responsive values
  • Remember that vmin/vmax consider both dimensions, making them truly responsive

Common Use Cases

// Most common vmin/vmax applications
1. Responsive Typography: font-size: 4vmin;
2. Perfect Squares/Circles: width: 50vmin; height: 50vmin;
3. Full-screen Sections: height: 100vmin; width: 100vmax;
4. Responsive Padding/Margin: padding: 2vmin;
5. Aspect Ratio Maintenance: aspect-ratio: 1/1; width: 80vmin;
6. Icon Sizes: width: 8vmin; height: 8vmin;
7. Button Sizes: min-width: 20vmin; padding: 1vmin 3vmin;
8. Border Radius: border-radius: 2vmin;

Comparison with Other Units

ScenarioVWVHVMinVMaxBest Choice
Mobile portrait textScales with widthScales with heightScales with width (smaller)Scales with height (larger)VMin (consistent on rotation)
Mobile landscape buttonScales with widthScales with heightScales with height (smaller)Scales with width (larger)VMin (consistent on rotation)
Full-width desktop hero100vw (full width)100vh (full height)100vmin (full smaller side)100vmax (full larger side)VMax (truly full screen)
Square image containerWidth-based onlyHeight-based onlyScales with smaller dimensionScales with larger dimensionVMin (maintains square shape)
Fixed aspect ratio videoWidth controls heightHeight controls widthScales proportionallyScales proportionallyVMin/VMax + calc()

Understanding CSS Viewport Minimum (VMIN) and Maximum (VMAX)

While standard CSS viewport units like Viewport Width (vw) and Viewport Height (vh) anchor layout dimensions to a single fixed axis, responsive web design often presents challenges where elements must respect the overall aspect ratio of the device screen. When a smartphone user transitions between portrait and landscape orientations, standard width or height declarations frequently cause awkward visual scaling or unintended horizontal clipping.

To solve these orientation-dependent layout hurdles, the W3C CSS Values and Units specification introduced VMIN (Viewport Minimum) and VMAX (Viewport Maximum). Rather than linking exclusively to either width or height, these intelligent units evaluate both axes simultaneously in real-time:

  • 1vmin: Represents 1% of the browser viewport’s smaller dimension. In landscape orientation (where width exceeds height), 1vmin = 1vh. In portrait orientation (where height exceeds width), 1vmin = 1vw.
  • 1vmax: Represents 1% of the browser viewport’s larger dimension. In landscape orientation, 1vmax = 1vw. In portrait orientation, 1vmax = 1vh.

Mathematical Formulas: Converting Between VMIN, VMAX, and Pixels

The calculation of pixel equivalents for VMIN and VMAX depends on identifying the minimum and maximum boundaries of the active viewport display:

VMIN to Pixels Formula
PX = VMIN × (min(Width, Height) ÷ 100)
VMAX to Pixels Formula
PX = VMAX × (max(Width, Height) ÷ 100)

Let us walk through a concrete example using standard desktop display dimensions of 1920px width by 1080px height:

  1. Identifying the dimensions: Width is 1920px, and Height is 1080px. The smaller dimension is 1080px (the minimum), and the larger dimension is 1920px (the maximum).
  2. Calculating 10vmin: 10 × (1080 ÷ 100) = 10 × 10.8 = 108px. Because height is the smaller boundary, 10vmin computes identically to 10vh on this desktop setup.
  3. Calculating 10vmax: 10 × (1920 ÷ 100) = 10 × 19.2 = 192px. Because width is the larger boundary, 10vmax computes identically to 10vw on this desktop setup.

Now consider a modern smartphone in portrait mode with dimensions of 390px width by 844px height. Here, the roles reverse: width is the smaller dimension (390px), so 10vmin = 39px, while height is the larger dimension (844px), so 10vmax = 84.4px.

Comprehensive VMIN and VMAX Reference Matrix

The table below highlights computed pixel dimensions for standard VMIN and VMAX declarations across diverse device resolutions and orientations:

Unit DeclarationMobile Portrait (390×844)Tablet Landscape (1024×768)Full HD Desktop (1920×1080)4K UHD Display (3840×2160)
5 vmin19.50 px38.40 px54.00 px108.00 px
10 vmin39.00 px76.80 px108.00 px216.00 px
25 vmin97.50 px192.00 px270.00 px540.00 px
50 vmin195.00 px384.00 px540.00 px1080.00 px
5 vmax42.20 px51.20 px96.00 px192.00 px
10 vmax84.40 px102.40 px192.00 px384.00 px
25 vmax211.00 px256.00 px480.00 px960.00 px
50 vmax422.00 px512.00 px960.00 px1920.00 px

Key Design Patterns and Production Use Cases

Knowing when to choose VMIN or VMAX over traditional CSS units elevates user experience and prevents unexpected edge-case display clipping. Four primary design patterns demonstrate the unique strengths of these units:

1. Guaranteed-Fit Modals and Square Containers

When displaying a square image crop, video dialogue, QR code container, or canvas game area, declaring width: 70vmin; height: 70vmin; guarantees that the element will always remain entirely visible on the screen without overflowing or introducing vertical/horizontal scrollbars, regardless of device orientation.

2. Ambient Full-Bleed Decorative Overlays

When styling background atmospheric glowing blobs, circular gradients, or animated canvas particles, sizing them with width: 120vmax; height: 120vmax; ensures the decorative element fully spans the viewport in both landscape and portrait orientations without leaving unstyled margins.

3. Orientation-Invariant Typography

Styling prominent headline typography using clamp(24px, 5vmin, 64px) prevents text from ballooning to enormous sizes when a mobile user flips into landscape mode (which happens if using vw), or shrinking down into unreadability (which happens if using vh).

4. Floating Action Buttons and Avatars

Setting icon action buttons or user profile avatars with width: 12vmin; height: 12vmin; border-radius: 50%; creates perfectly circular interactive touch targets that scale gracefully across smartwatch screens, phones, and tablets.

Comparing Viewport Units: VMIN vs VMAX vs VW vs VH

To determine which viewport unit fits your specific layout component, review this comparative architectural breakdown:

UnitReference AxisBehavior on Device RotationPrimary Recommended Use
VWWidth (Horizontal)Expands in landscape, contracts in portraitMulti-column grids, horizontal margins, fluid typography
VHHeight (Vertical)Contracts in landscape, expands in portraitFull-screen hero banners, sticky vertical sidebars
VMINSmaller of Width or HeightRemains constant in magnitude; changes reference axisSquare modals, game canvases, non-clipping circular avatars
VMAXLarger of Width or HeightRemains constant in magnitude; changes reference axisFull-bleed ambient gradients, background cover graphics

Frontend Implementation Best Practices and Pitfalls

While VMIN and VMAX offer exceptional adaptability, implementing them without proper constraints can introduce usability flaws:

1. Always combine VMIN with clamp() for text

Never declare plain font-size: 4vmin; without limits. On a small 320px mobile screen, 4vmin is only 12.8px (which violates WCAG minimum readability guidelines), while on an ultra-wide screen it can grow excessively large. Always wrap it: font-size: clamp(16px, 4vmin, 28px);.

2. Be cautious with VMAX for content containers

Applying VMAX to a content container’s width or height on an ultra-wide 21:9 monitor can cause it to stretch across thousands of pixels, throwing readable text off the screen or creating painful eye-tracking distances. Reserve VMAX primarily for aesthetic background treatments.

3. Account for mobile address bars

On mobile devices, browser URL bars retract on scroll. The W3C Level 4 specifications introduce svmin, lvmin, and dvmin to account for dynamic address bar states. Always test your VMIN interfaces against active mobile Safari and Chrome viewports.

Step-by-Step Code Recipe: Centered Square Modal Without Scrollbars

A ubiquitous challenge in web application development is engineering a dialog box or camera scanner interface that must maintain a 1:1 square aspect ratio while remaining completely visible on both portrait mobile phones and ultra-wide desktop displays without triggering scrollbars.

By applying VMIN units, you guarantee that the modal’s bounding dimensions never exceed the smaller dimension of the physical viewport:

.camera-scanner-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Sized at 80% of whichever screen axis is smaller */
  width: 80vmin;
  height: 80vmin;
  max-width: 600px;
  max-height: 600px;
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

On a smartphone held upright (390×844px), this modal evaluates to 80% × 390px = 312px wide and tall. When the user turns the phone sideways into landscape mode (844×390px), the modal smoothly remains exactly 80% × 390px = 312px, perfectly framed in the center of the screen with comfortable margins on all sides. This eliminates clumsy JavaScript resize event listeners and prevents layout thrashing entirely.

Conclusion and Key Takeaways

CSS VMIN and VMAX represent sophisticated, orientation-aware units that bridge the gap between static pixel coordinates and responsive fluid grids. By utilizing the interactive converter above to verify pixel dimensions across diverse aspect ratios and adhering to modern responsive clamping rules, you can design fluid web experiences that look polished and intentional on any screen orientation.

Frequently Asked Questions (FAQs)

VMIN and VMAX are relative CSS viewport units based on the dimensions of the browser window. 1vmin equals 1% of the viewport's smaller dimension (minimum between width and height), while 1vmax equals 1% of the viewport's larger dimension (maximum between width and height).

The formula is: PX = VMIN × (min(Viewport Width, Viewport Height) ÷ 100). For example, on a 1920×1080 display, the smaller dimension is 1080px. Thus, 10vmin equals 10 × (1080 ÷ 100) = 108px.

The formula is: PX = VMAX × (max(Viewport Width, Viewport Height) ÷ 100). For example, on a 1920×1080 display, the larger dimension is 1920px. Thus, 10vmax equals 10 × (1920 ÷ 100) = 192px.

When a phone switches from portrait (e.g., 375×812) to landscape (812×375), the numerical pixel values of 1vmin and 1vmax remain constant because the minimum dimension (375px) and maximum dimension (812px) do not change—only the axis changes.

VMIN is ideal for square components, circular modal dialogues, avatar frames, and mobile game viewports that must remain completely contained inside the screen boundaries without causing scrolling in either portrait or landscape mode.

VMAX is ideal for background decorative graphics, ambient animated circles, full-screen video backdrops, and cover banners that must completely cover the entire screen canvas regardless of whether the display is oriented horizontally or vertically.

Yes, VMIN and VMAX are official W3C CSS specifications supported across 100% of modern web browsers, including Google Chrome, Apple Safari, Mozilla Firefox, Microsoft Edge, and mobile browser engines.

Yes, combining VMIN with clamp() provides incredible responsive control: clamp(16px, 4vmin, 32px) ensures typography scales smoothly with the smaller screen boundary while maintaining strict minimum and maximum pixel boundaries.

Explore Related Responsive CSS Converters

Convert between viewport, relative, and physical CSS dimensions:

Explore Related Tools

Hand-picked utilities and calculators related to this tool.

Pixels Converter