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 casesTap to collapse
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
- 1Start from a preset - Full-screen app, Bottom tab bar, Notch-safe header, or Landscape side insets - or configure by hand.
- 2Pick the device and toggle portrait / landscape; the preview and inset cards update to match the hardware insets.
- 3Choose which sides to pad (top / right / bottom / left). For landscape notches the cutout moves to the left and right.
- 4Set a minimum padding to combine via max(), then pick an output format: max-combined is the recommended default.
- 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 MaxUsable viewport (portrait, 393×852)
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.
Presets
Custom configuration — adjust any option below.
Options
Dynamic Island. Top inset 59px portrait, home-indicator 34px.
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
- CSS FormatterFormat and beautify CSS code
- Skeleton Screen GeneratorBuild layout-matched skeleton loaders (card/list/article/table) with shimmer/pulse/wave and a live preview
- Spacing Scale CalculatorLinear, geometric, Fibonacci or modular spacing scales with a visual ruler preview and utility classes — export CSS, Tailwind v4, SCSS, JSON
- Tailwind Config GeneratorVisually build a Tailwind config - theme extend, colors, spacing, fonts, screens, plugins - and export it as a v3 JS config or a v4 @theme CSS block
- Transition & Easing StudioDrag a cubic-bezier curve, play it on a live demo, and export CSS, @keyframes, Tailwind, Framer, or WAAPI
- App Icon GeneratorTurn one image into complete icon sets for iOS, Android, Web/PWA & macOS — Contents.json, adaptive icons, maskable, manifest & favicon.ico — in one ZIP
Almost always because the page is missing viewport-fit=cover in its viewport meta tag. By default the browser keeps your layout inside the safe area and reports every env(safe-area-inset-*) value as 0, so padding by those values changes nothing. Add the viewport meta tag with viewport-fit=cover (the tool generates this for you) so the layout draws edge-to-edge and the insets become non-zero. The audit in this tool warns you whenever the reminder is off.
On a device with no inset on a given side - an older phone, a desktop, or simply the left/right edges in portrait - env() resolves to 0. A bare padding: env(safe-area-inset-bottom) then collapses to nothing, leaving content flush against the screen edge. max(16px, env(safe-area-inset-bottom)) keeps a sensible baseline padding everywhere and only grows it where the hardware actually reserves space. That is why max-combined is the recommended default output here.

