General

Squircle vs. Rounded Rectangle: The Math Behind Apple Corners and G2 Curves (2026)

January 25, 2026 14 min read Verified Medical Review
Quick Summary & Key Insights

Standard CSS border-radius snaps straight edges directly into circular arcs. Learn why Apple uses G2 continuous superellipses, how the Lamé curve works, and how to render clean rounded assets.

  • Optimized for Squircle vs rounded rectangle 2026
  • Optimized for Apple squircle formula
  • Optimized for G2 curvature continuity css

Definition & Core Difference

A rounded rectangle joins straight edges to fixed circular arcs with G1 continuity, creating an abrupt jump in curvature where the lines meet. A squircle is a mathematical superellipse ($|x/a|^n + |y/b|^n = 1$) that achieves G2 continuity: the curvature accelerates continuously from zero into the turn, eliminating optical kinks and matching the organic curvature of Apple iOS icons and hardware bezels.

1. The Continuity Hierarchy: G0, G1, and G2 Explained

In computer-aided industrial design and vector typography, transitions between line segments are classified by their degree of geometric smoothness:

Class Derivative Match Real-World Geometry Optical Behavior
G0 (Positional) Endpoints touch: $P_1 = P_2$ Sharp, unrounded 90-degree corner. Hard acute angle. Zero curvature transition.
G1 (Tangential) First derivative matches: $f'(x_1) = f'(x_2)$ Standard CSS border-radius. Straight lines meet circular arcs. Visible "kink" at the junction where curvature jumps instantaneously from 0 to $1/r$.
G2 (Curvature) Second derivative matches: $f''(x_1) = f''(x_2)$ Apple Superellipse (Lamé curve, $n approx 4.5 ext{--}5$). Liquid, organic curve. Curvature ramps smoothly from zero into the corner apex.

Vector Comparison: G1 Tangent vs. G2 Curvature Continuity

CSS border-radius (G1) Tangential Jolt (κ = 0 → 1/r) Apple Superellipse (G2) Smooth Curvature (κ → ∇κ → 0) Zero Sharp Tangent Kinks

Notice how the G1 curve on the left has an explicit corner break point at [200, 90], while the G2 curve on the right bends progressively.

2. The Lamé Curve Formula: Decoding Exponent "n"

In 1818, French mathematician Gabriel Lamé published the general equation for superellipses:

|x / a|n + |y / b|n = 1

When tuning geometric shapes for digital devices, the exponent $n$ controls the profile:

  • $n = 2$: Standard circle (or ellipse when $a eq b$). Constant, uniform curvature.
  • $n = 4$: Classic mathematical Squircle. Flat midsections with soft continuous transitions.
  • $n approx 4.5 ext{--}5$: Apple's iOS icon profile. Preserves straight edges across 60% of the bounding box while softening the corner approach.
  • $n o infty$: Pushes coordinates completely to the bounding corners, resulting in an unrounded rectangle.

3. Why CSS Cannot Do This Natively (And Why Houdini Failed)

Modern browsers still lack a native border-corner-shape: squircle property. Developers have experimented with three alternative implementations, each carrying concrete production trade-offs:

1. CSS Paint API (Houdini)

A custom worklet script computes the Lamé curve in JS and draws it onto an element's background. Unfortunately, Safari has refused to implement Houdini Paint, and Firefox hides it behind flags. A CSS trick that breaks on iPhones fails the core audience.

2. SVG clip-path

You map cubic Bézier points to approximate a superellipse and clip HTML containers. It works, but it breaks GPU compositing during scroll, blurs fine font sub-pixels, and requires fixed aspect ratios.

3. Pre-Rendered Canvas PNG

Instead of demanding client CPUs recompute differential geometry on every DOM reflow, you rasterize the curve into a transparent 32-bit PNG asset. Zero runtime layout tax. Flawless rendering on every mobile and desktop browser.

That third approach is what the RapidDoc Image Radiator implements. The engine draws your source photo onto an offscreen canvas, clips the border using cubic Bézier splines calibrated to $n=4.5$, and exports a clean transparent PNG.

4. Production Code: Vanilla JavaScript Canvas Squircle Clipper

If you want to render a true G2-approximated squircle directly inside an HTML5 <canvas> element without third-party libraries, use this cubic Bézier curve implementation:

function drawSquirclePath(ctx, x, y, width, height, r) {
  // r: corner radius scalar (e.g. 0.22 * width for Apple icons)
  const a = width / 2;
  const b = height / 2;
  const k = 0.5522847498; // Standard circle kappa
  // Shift control points outward to simulate n=4.5 curvature acceleration
  const squircleOffset = r * 0.35; 

  ctx.beginPath();
  ctx.moveTo(x + r, y);
  ctx.lineTo(x + width - r, y);
  ctx.bezierCurveTo(x + width - squircleOffset, y, x + width, y + squircleOffset, x + width, y + r);
  ctx.lineTo(x + width, y + height - r);
  ctx.bezierCurveTo(x + width, y + height - squircleOffset, x + width - squircleOffset, y + height, x + width - r, y + height);
  ctx.lineTo(x + r, y + height);
  ctx.bezierCurveTo(x + squircleOffset, y + height, x, y + height - squircleOffset, x, y + height - r);
  ctx.lineTo(x, y + r);
  ctx.bezierCurveTo(x, y + squircleOffset, x + squircleOffset, y, x + r, y);
  ctx.closePath();
}

5. Dual-Layer Ambient Occlusion Shadows

Rounding an asset without giving it depth leaves it looking flat. But applying a harsh black drop shadow (0 10px 20px rgba(0,0,0,0.5)) looks dated. Real light in a physical room scatters into two distinct shadow layers:

Physics of Natural Drop Shadows: Umbra vs. Penumbra

UI Card Surface ← Umbra (Contact: 0 2px 4px 12%) ← Penumbra (Ambient: 0 24px 48px 8%)

When you combine G2 squircle clipping with dual-layer ambient occlusion, your screen captures feel like tangible physical cards floating above the page. In social feeds, this tactile quality stops users from scrolling past.

6. Asymmetrical Radii & Screenshot Window Chrome

Decoupling individual corners allows you to build directional UI shapes:

Layout Style Corner Values (TL / TR / BR / BL) Production Application
The Docked Tab 24px / 24px / 0px / 0px Modal headers and bottom-docked dashboard panels.
The Chat Pointer 28px / 28px / 4px / 28px Testimonial quotes and message bubbles where the bottom-right corner acts as a speaking cue.
The Diagonal Leaf 48px / 0px / 48px / 0px Editorial banners and consumer marketing carousels that break square grid fatigue.

For software documentation and product launches, the Image Radiator lets you wrap any screenshot in simulated macOS window chrome with red (#FF5F56), yellow (#FFBD2E), and green (#27C93F) traffic-light controls. All rendered locally in your browser memory.

Connected Downstream Utilities

Need to scale your rounded mockup to exact social banner dimensions? Pass it to our Smart Image Resizer. Need to shave 80% off the transparent PNG file size before web deployment? Optimize it using the Smart Image Compressor.

Enterprise Reliability Protocol

System Sovereignty & Engineering

Edge Computing

100% Client-side processing. Your data never leaves your browser sandbox, ensuring absolute compliance with US privacy mandates.

Modular Schema

Modular utility architecture optimized for performance. Low-latency WASM kernels provide near-native speeds for complex transformations.

Sustainable Design

Sustainable, green computing by offloading compute to the edge. Verified zero-server storage (ZSS) for professional-grade security.

Q&A

Frequently Asked Questions

A standard rounded rectangle connects straight lines to circular arcs with constant curvature (G1 continuity). At the junction point, curvature jumps abruptly from 0 to 1/r, creating an optical pinch. A squircle follows the Lamé curve equation (|x/a|^n + |y/b|^n = 1) with an exponent around 4 or 5, ensuring that curvature accelerates gradually into the corner (G2 continuity) with zero harsh transitions.
CSS border-radius only supports circular and elliptical arcs (G1 continuity). The W3C specification has no property for superellipses. While the CSS Paint API (Houdini) can draw them programmatically, it is completely unsupported in Safari and Firefox, making client-side canvas pre-rendering the only reliable cross-browser solution.
JPEG does not support alpha transparency channels. If you export a rounded image as a JPG, the cut-out corner areas will automatically turn solid white or solid black. PNG and WebP preserve the transparent alpha channel so the rounded corners sit cleanly over any background.
Yes. In the Image Radiator workbench, unlock the corner link icon. You can set Top-Left and Top-Right to 24px while keeping Bottom-Left and Bottom-Right at 0px.
No. RapidDocTools operates 100% inside your browser using the HTML5 Canvas API. Your source image files never leave your device memory, ensuring strict privacy for unreleased UI screenshots, pitch decks, and internal documents.
An ambient occlusion shadow mimics natural room lighting by using two combined shadow passes: a tight, sharp contact shadow (umbra) right along the edge of the object, and a soft, wide, low-opacity blur (penumbra) dispersing into the background. This avoids the muddy, artificial look of single-layer drop shadows.
Apple uses a superellipse with an exponent close to n=4.5 to 5. Upload a square image (e.g., 1024x1024 pixels), select the Squircle preset, apply approximately 22% corner radius, and export as a transparent PNG.