Rounded corners are a hallmark of contemporary design. From mobile app
icons to web cards and buttons, the subtle curve softens a box’s
edges, making interfaces appear more approachable. In CSS, the
border-radius
property controls these curves. While a
single value applies uniformly, CSS lets you specify distinct radii
for each corner, even allowing elliptical shapes with two radii per
corner. This generator exposes that flexibility by providing inputs
for the top-left, top-right, bottom-right, and bottom-left corners.
The linked mode synchronizes values so you can quickly experiment with
uniform rounding; unchecking it lets you sculpt asymmetric
silhouettes.
The geometric idea behind rounded corners is simple: replace the sharp corner of a rectangle with an arc of a circle. If the radius is large enough, the arc becomes a semicircle, turning the rectangle into a pill shape. When two radii are specified for a corner—one horizontal, one vertical—the arc is part of an ellipse rather than a circle. This allows complex shapes like stadiums, leafs, and speech bubbles. Mastery of border radius helps designers prototype these forms without external graphics tools.
Each corner of a box can be described by two radii: for the horizontal axis and for the vertical axis. If only one number is provided, CSS uses the same value for both axes, producing a circular arc. The arc follows the equation of an ellipse:
Within a corner the browser trims the rectangle along this curve. CSS limits radii so that they never overlap; if the sum of horizontal radii on one side exceeds the box’s width, the browser scales them proportionally to fit. A similar adjustment occurs vertically. This ensures that no corner intrudes into its neighbor, preserving visual coherence.
The border radius syntax accepts between one and eight values. Providing four values specifies each corner in order: top-left, top-right, bottom-right, bottom-left. Adding a slash and four more values introduces separate vertical radii. The following table demonstrates common patterns:
Declaration | Visual Effect |
---|---|
border-radius: 10px; |
All corners rounded equally |
border-radius: 10px 20px; |
Top-left & bottom-right = 10px, top-right & bottom-left = 20px |
border-radius: 50%; |
Circle if element is square |
border-radius: 40px/20px; |
Elliptical corners, horizontal radius 40px, vertical radius 20px |
border-radius: 0 30px 50px 0; |
Creates a cartoon speech-bubble tail |
Why do rounded corners appeal to humans? Psychologists suggest that sharp angles signal danger in nature, while curves feel safer. UX research also shows that rounded boxes guide the eye inward, helping users focus on the content. Yet excessive rounding can reduce readability or waste space. A balance must be struck depending on the brand personality and device context. For touch interfaces, larger radii often pair with bigger hit targets, reflecting the finger’s natural shape.
From a performance standpoint, border radius is inexpensive to render on modern hardware because browsers delegate the actual drawing to the GPU. That said, animating very large radii or using it in conjunction with heavy box-shadow effects can still tax older devices. Designers should test across platforms when preparing production interfaces.
This generator streamlines experimentation. By adjusting the numeric fields you instantly see the impact on the preview box and the accompanying CSS code. Checking “Link radii” mirrors the top-left value to the other corners. Unchecking it activates independent controls, ideal for shaping callouts or custom components. The code text area displays the declaration ready to copy into a stylesheet. Because everything runs in the browser, no data or design mockup leaves your machine.
The script reads the four input values and assembles a
border-radius
string. When linking is enabled, any change
to one field updates all others before calculating. The
update
function concatenates the radii in the required
order and sets the style.borderRadius
of the preview
element. It also writes the CSS code to the text area. An event
listener monitors changes to each input and to the link checkbox.
Because the script is short, it executes instantly, providing a
responsive design playground.
Providing two radii per corner unlocks a wealth of shapes. Imagine a dialog bubble with a small tail. You can simulate it by using a large radius on one bottom corner and a zero on the adjacent corner, then overlaying a pseudo-element. Elliptical radii also craft organic blobs by combining large horizontal radii with smaller vertical ones. Understanding the ellipse equation helps predict how the curve will stretch. If , the arc appears twice as wide as it is tall.
Percent values add another dimension. Setting
border-radius: 50%
on a square yields a perfect circle;
on a rectangle it creates a capsule. Percentages are relative to the
element’s dimensions, so resizing the box changes the curvature.
Designers can leverage this for responsive layouts: a card might use
border-radius: 2%
to maintain proportional rounding on
any screen.
Rounded corners predate digital interfaces. Architects of the
mid-century modern movement embraced curved edges to soften concrete
buildings, while industrial designers like Dieter Rams applied them to
radios and calculators. When Apple introduced the original Macintosh
in 1984, its GUI used tiny 1-pixel rounding to mimic friendly
hardware. The trend waxed and waned: early web pages relied on
rectangular tables, then designers employed images to fake curves. The
advent of CSS3 in the late 2000s finally standardized
border-radius
, democratizing rounded corners for all
browsers. Today the property is ubiquitous, yet understanding its
nuances remains valuable.
The table below illustrates how different values translate into shapes. Try replicating them using the generator inputs.
Top-Left | Top-Right | Bottom-Right | Bottom-Left | Description |
---|---|---|---|---|
0 | 0 | 0 | 0 | Sharp rectangle |
20 | 20 | 20 | 20 | Pill if width ≥ height |
50 | 10 | 50 | 10 | Ribbon effect |
60 | 0 | 60 | 0 | Speech bubble edge |
100 | 100 | 0 | 0 | Ticket stub |
Beyond simple boxes, border-radius
influences complex
components. On forms it can soften input fields, encouraging
interaction. In dashboards, rounded panels differentiate sections
without heavy borders. Media players often use circular progress bars
built from elements with 50% radii. Even charts may rely on rounded
rectangles to highlight data points. Designers exploring generative
art craft abstract shapes by animating radii over time, creating
morphing blobs reminiscent of liquid.
Mastering border radius is more than memorizing syntax; it involves understanding geometry, human perception, and design history. This generator offers a playground for that exploration. By adjusting values and observing the results, you build intuition about how radii interact. The extensive explanation, formulas, and tables above serve as reference material, ensuring you not only copy a snippet but grasp the reasoning behind it. Rounded corners may seem like a small detail, yet in interface design they contribute significantly to a product’s feel. With this tool you can craft them precisely and confidently.