Bézier curves explained

Every letter on this screen, every SVG icon and every path in a drawing program is made of Bézier curves: smooth curves steered by a handful of control points. This page explains the formula behind them, the beautifully simple construction that draws them with nothing but repeated interpolation, the properties that make them so well behaved, and how they are joined into the paths of fonts and vector graphics.

A cubic Bézier curve in rose with its four control points, the grey control polygon and the shaded convex hull, de Casteljau's nested segments in blue and green meeting at the point B(t) with its violet tangent arrow, and the four Bernstein basis polynomials graphed beside it with the current t marked

Control points and the formula

A Bézier curve of degree n is fixed by n + 1 control points P₀, P₁, …, Pₙ. Its point at the parameter t, which runs from 0 to 1, is the weighted average B(t) = Σ Bᵢ,ₙ(t)·Pᵢ, where the weights are the Bernstein polynomials Bᵢ,ₙ(t) = C(n, i)·tⁱ·(1 − t)ⁿ⁻ⁱ. A curve of degree 1 is the straight segment (1 − t)·P₀ + t·P₁; degree 2, the quadratic, is (1 − t)²·P₀ + 2t(1 − t)·P₁ + t²·P₂, an arc of a parabola; degree 3, the cubic, is (1 − t)³·P₀ + 3t(1 − t)²·P₁ + 3t²(1 − t)·P₂ + t³·P₃, the curve of nearly all design software. The curve starts at P₀ and ends at Pₙ; the points in between are not on it, they pull it towards themselves like magnets.

De Casteljau's construction

There is a way to find B(t) with a ruler alone. Mark the point that divides each leg of the control polygon in the ratio t : (1 − t); this gives n points and n − 1 new segments. Divide those in the same ratio, and repeat. Each level has one point fewer, and after n levels a single point is left: it is exactly B(t). This is de Casteljau's algorithm, found by Paul de Casteljau at Citroën in 1959. It uses only additions and multiplications by t and 1 − t, which makes it numerically very stable, and it explains the formula: expanding the repeated interpolation gives the binomial coefficients and powers of the Bernstein polynomials. The two points of the last level span a segment that touches the curve at B(t): it is the tangent, and the velocity is B′(t) = n·(P₁ⁿ⁻¹ − P₀ⁿ⁻¹).

The Bernstein basis

Sergei Bernstein introduced his polynomials in 1912 to prove the Weierstrass approximation theorem, long before anyone drew curves with them. For every t they are never negative and add up to exactly 1 (they are the terms of (t + (1 − t))ⁿ), so B(t) is always a true weighted average of the control points. Bᵢ,ₙ has a single peak at t = i/n, so each control point dominates the part of the curve near its own share of the parameter, but every control point influences the whole curve a little: moving one point moves every point of the curve except the two ends. The app graphs the basis with the current t, so you can read off how strongly each control point pulls on B(t) at that moment.

Properties: hull, ends and affine maps

Because B(t) is a weighted average with non-negative weights, the curve lies inside the convex hull of its control points, the smallest convex polygon containing them; this makes it cheap to test whether two curves might intersect or whether a curve is on screen. The curve leaves P₀ in the direction of P₁ and arrives at Pₙ from the direction of Pₙ₋₁, so the first and last legs are the end tangents, which is why drawing programs show them as handles. Bézier curves are affinely invariant: to turn, scale, shear or move a curve it is enough to transform its control points, because a weighted average whose weights sum to 1 commutes with affine maps. The length of the curve, however, is not given by any simple formula; it is the integral of the speed |B′(t)| from 0 to 1, which the app computes numerically with Gauss–Legendre quadrature.

Subdivision and degree elevation

De Casteljau's triangle does more than find a point. The first points of every level, P₀, P₀¹, …, B(t), are the control points of the part of the curve from 0 to t, and the last points, B(t), …, Pₙ, those of the part from t to 1. Splitting a curve this way is exact and is how renderers flatten curves into short lines, how two curves are intersected and how a curve is cut in two. In the other direction, any curve of degree n is also a curve of degree n + 1: the new control points Qᵢ = (i/(n + 1))·Pᵢ₋₁ + (1 − i/(n + 1))·Pᵢ lie on the old polygon and give exactly the same curve. That is how a quadratic TrueType outline is turned into cubics without changing a single letter.

Rational curves and the circle

A polynomial Bézier curve can never be an exact circle. A cubic with handles of length k·r, where k = 4(√2 − 1)/3 ≈ 0.5523, comes very close: four of them stray from a true circle by only 0.027 % of the radius, which is how most software draws circles. Giving each control point a weight wᵢ and dividing by Σ wᵢBᵢ,ₙ(t) makes a rational Bézier curve, the same as running de Casteljau's algorithm in homogeneous coordinates. A rational quadratic is a conic section: an ellipse for w < 1, a parabola for w = 1 and a hyperbola for w > 1, and on an isosceles control triangle with w = cos(θ/2) it is an exact circular arc of angle θ. Rational curves with knots are the NURBS of engineering CAD.

Paths, splines and continuity

A single curve of high degree is hard to control, so shapes are built from many low-degree segments joined end to end: a path. At a join the curve may only meet (C0 continuity, a corner), its handles may line up so the direction is the same (G1, smooth to the eye), the handles may be mirror images so the velocity is the same (C1), or the second derivative may also match (C2), which makes the curvature continuous and is what a cubic B-spline gives automatically. Designers check smoothness with a curvature comb, lines along the normal as long as the curvature: a jump in the comb shows where a join is only G1 or C1. Font outlines are paths of quadratic segments in TrueType and of cubic ones in PostScript and OpenType CFF; SVG paths use the commands L, Q and C for segments of degree 1, 2 and 3.

History and how the app computes

Paul de Casteljau worked out the algorithm at Citroën in 1959 but his reports stayed secret; Pierre Bézier, an engineer at Renault, published the same curves in the 1960s for the UNISURF system that designed car bodies, and they were named after him. They reached everyone through PostScript in 1984 and the fonts and drawing programs that followed. The app evaluates every point with de Casteljau's algorithm in homogeneous coordinates (exact for rational weights), its derivatives from the hodograph, the curvature as (x′y″ − y′x″)/|B′|³, the arc length by composite five-point Gauss–Legendre quadrature, cusps by minimising the speed and loops by intersecting a fine polyline, and it measures the continuity of each join from the derivatives on both sides. Curves of degree above 3 and rational ones are exported to SVG as cubic pieces that match the curve's points and velocities within half a pixel.

Frequently asked questions

Why are cubic Bézier curves used more than any other degree?

A cubic is the lowest degree that can have an inflection point and whose two ends can be given any position and any tangent independently, so cubic segments can join smoothly into any shape while staying cheap to compute. Quadratics need more segments for the same shape (they are arcs of parabolas and cannot have an S-bend), and higher degrees are harder to steer because every control point affects the whole curve.

Does t measure distance along the curve?

No. t is a parameter, not the arc length: B(0.5) is generally not halfway along the curve, and the point moves faster where the control points are far apart. The app's tiles show both t and the arc length up to t, and Play makes the difference visible as the point speeds up and slows down; with Sound on, the tone follows the speed |B′(t)|.

What is the difference between a Bézier curve and a B-spline?

A Bézier curve is one polynomial piece whose control points all affect the whole curve. A B-spline is a chain of polynomial pieces joined with built-in continuity (C2 for cubics), each control point affecting only a few neighbouring pieces; every B-spline can be converted into Bézier segments, which is what the app's smooth C2 spline example shows. NURBS add weights and uneven knots to B-splines, just as rational Bézier curves add weights to Bézier curves.

How can a curve with four control points make a loop or a cusp?

When the inner control points are pulled far enough across each other, the curve's velocity turns back: if it passes through zero the curve has a cusp, a sharp point where B′(t) = 0, and if it swings round without stopping, the curve crosses itself in a loop. The app's loop and cusp examples show both, and it finds the cusp and the crossing parameters numerically.

Ready to try it?

Open PictorX in your browser — no install, no credit card required to start.

Open the Bézier curves app