Rounding every corner of a box with a single border-radius is the usual case, and it rarely surprises anyone. Giving each corner its own value is just as simple — the property accepts four. What catches people out is that rounded corners drawn from one side can collide with those drawn from the other, and the browser quietly alters the numbers you wrote to stop that from happening.
Why the oversized radius trick survives
Set border-radius to something absurd — 999em, or 999vmax — and the box doesn't turn into an impossible shape. The corners simply round off into semicircles. The appeal is that you don't need to know the rectangle's dimensions for a pill shape to come out; it just works. Lea Verou's blog carries an early mention of the technique in a comment by David Baron.
That hack, it turns out, is a side effect of the same overlap rule that breaks more innocent-looking declarations.
The disappearing 40px corner
Imagine a rectangle where the right pair of corners should be pill-shaped and the left pair rounded to 40px. Written as code, the left corners seem to vanish entirely.

They haven't been dropped. The browser has scaled their values down so far that they merely look gone — and the spec explains by how much.
Let f = min(Li/Si), where i ∈ {top, right, bottom, left}, Si is the sum of the two corresponding radii of the corners on side i, and Ltop = Lbottom = the width of the box, and Lleft = Lright = the height of the box. If f < 1, then all corner radii are reduced by multiplying them by f.
Reading the formula
Stated plainly, the algorithm shrinks every radius by a common factor until none of them overlap. It is the radii that must not overlap, not the circles they describe — those may still cross. The whole point of the rule is overlap prevention, which is also why the oversized-value trick produces a pill in the first place.
Concretely, the browser takes each side of the box, divides its length by the sum of the radii touching it, and keeps the smallest of those four ratios. That smallest ratio is then applied to all radii, not just the offending ones.
For the standard pill hack the arithmetic runs like this:
[Width of Side] / [Adjacent Border Radius 1 + Adjacent Border Radius 2]
Top: 200px / (400px + 400px) = 0.25
Right: 100px / (400px + 400px) = 0.125
Bottom: 200px / (400px + 400px) = 0.25
Left: 100px / (400px + 400px) = 0.125

The least ratio is 0.125, so the initial 400px radii all shrink to 50px:
400px * 0.125 = 50px
On a rectangle whose short sides measure 100px, that leaves a perfect pill. (400px stands in for the "absurdly large" value here so the process is visible; any figure at least half the short side will overlap.) Watching the specified circles shrink by one shared ratio makes the behaviour easier to follow, especially since they start at equal sizes.
Where the proportional approach costs you
The hybrid pill case is worth walking through again with a milder setup, so the shrinkage is visible without wiping the small corners out.
The ratio calculation repeats, and once more 0.125 is the smallest result:
Top: 200px / (40px + 400px) = 0.455
Right: 100px / (400px + 400px) = 0.125
Bottom: 200px / (40px + 400px) = 0.455
Left: 100px / (40px + 40px) = 1.25
Multiplying through gives 50px on the right corners and 5px on the left. The two large radii on the right are now guaranteed not to overlap — but the small radii on the left have been reduced far more than the top, bottom and left sides required. In other words, the correction needed on one side of the box is charged to every corner.
Altering individual values in a live example makes the pattern clear: the large figures are what was requested, and the small ones are what the browser settles on to avoid overlap.
Why not shrink only the big ones?
A more targeted algorithm would reduce the largest radius, repeatedly, until nothing overlapped or until it matched the next largest — then continue. That would rescue the hybrid pill. It also has a failure mode: it can end with four equal radii where the author asked for four very different ones. The spec therefore has to deviate from the requested numbers in some direction, and scaling everything uniformly keeps the ratios between radii intact. That choice is the uniform-multiplier approach above.



