consolelog.tools

Safe Area Inset Calculator

Pick a device and orientation, choose which sides to pad, and copy the exact env(safe-area-inset-*) CSS — as plain classes, an @supports-guarded block, the max(Npx, env(...)) pattern, a Tailwind v3 plugin, a Tailwind v4 @theme snippet, or ready-made recipes for a bottom nav bar, sticky header, and floating action button. A live device preview shows the unsafe regions in red and the safe content area in green.

About this ToolHow it works, benefits & use cases

A focused generator for the env(safe-area-inset-*) CSS that keeps your content clear of notches, the Dynamic Island, punch-hole cameras, rounded corners, and gesture-nav home indicators. Pick a device from an expanded catalogue (iPhone 15/16 Dynamic Island lines, the classic notch phones, iPhone SE, iPad Pro, plus Android examples like the Pixel 8 and Galaxy S24), switch between portrait and landscape, and choose exactly which sides to pad. A live device-frame preview overlays the unsafe regions in red and the resulting safe content area in green, and inset stat cards plus a usable-viewport summary show how much screen the hardware reserves. Then export the exact recipe you need: plain .safe-* classes, an @supports-guarded block, the recommended max(Npx, env(...)) pattern that keeps a baseline padding everywhere, a Tailwind v3 plugin, a Tailwind v4 @theme/@utility snippet, or three real-world recipes for a fixed bottom navigation bar, a sticky header, and a floating action button. A built-in audit catches the silent failure mode: without viewport-fit=cover in your viewport meta tag, every inset resolves to 0 and the padding does nothing.

How to Use

  1. 1Start from a preset - Full-screen app, Bottom tab bar, Notch-safe header, or Landscape side insets - or configure by hand.
  2. 2Pick the device and toggle portrait / landscape; the preview and inset cards update to match the hardware insets.
  3. 3Choose which sides to pad (top / right / bottom / left). For landscape notches the cutout moves to the left and right.
  4. 4Set a minimum padding to combine via max(), then pick an output format: max-combined is the recommended default.
  5. 5Keep the viewport-fit=cover reminder on, add that meta tag to your <head>, and copy the generated CSS or share the URL.

Key Benefits

  • Expanded device catalogue: Dynamic Island, classic notch, iPhone SE, iPad Pro, and Android (Pixel 8, Galaxy S24)
  • Live device-frame preview showing unsafe regions in red and the safe content area in green, per orientation
  • Six output formats including the recommended max(Npx, env(...)) pattern, a Tailwind v3 plugin, and a Tailwind v4 @theme snippet
  • Ready-made recipes for a fixed bottom nav bar, a sticky header, and a floating action button
  • Inset stat cards and a usable-viewport summary (px and percentage) for both width and height
  • Audit that flags the missing viewport-fit=cover tag, which would silently zero out every inset
  • Everything captured in a shareable URL so you can hand a teammate the exact configuration

Common Use Cases

  • Padding a fixed bottom tab bar so it clears the home indicator on a notched iPhone
  • Building a sticky header that stays below the Dynamic Island or notch
  • Setting up an edge-to-edge installed PWA with viewport-fit=cover and the matching safe-area padding
  • Adding Tailwind safe-area utilities (v3 plugin or v4 @theme) to a mobile-first design system
  • Checking how much usable screen a given device and orientation actually leaves for content

Device preview

iPhone 16 Pro / 16 Pro Max
59px
Top
0px
Right
34px
Bottom
0px
Left

Usable viewport (portrait, 393×852)

Height: 759px (89.1%)Width: 393px (100.0%)

max(Npx, env(...)) — recommended

.safe-area {
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

Required meta tag

<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />

Without viewport-fit=cover every env(safe-area-inset-*) returns 0 and the padding does nothing.

Looks good

Presets

Custom configuration — adjust any option below.

Options

Dynamic Island. Top inset 59px portrait, home-indicator 34px.

Orientation
Apply to sides
px

env(safe-area-inset-*) only resolves to a non-zero value when this meta tag is present.

What are safe-area insets?

Phones with a notch, Dynamic Island, punch-hole camera, rounded corners, or a gesture-nav home indicator reserve part of the screen. When your layout draws edge-to-edge with viewport-fit=cover, the browser exposes the reserved sizes through the env(safe-area-inset-top/right/bottom/left) CSS variables so you can pad content out of the way.

Why the max() pattern

On a device with no inset, env() is 0, so a bare padding-bottom: env(safe-area-inset-bottom) collapses to nothing. Wrapping it in max(16px, env(safe-area-inset-bottom)) keeps a sensible baseline padding everywhere and grows it only where the hardware needs more — which is why it is the recommended default here.

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related tools