A blob is a closed shape with no corners and no symmetry: the soft colored forms placed behind illustrations, avatars and hero copy. They look hand drawn, but most are generated by a short algorithm. Knowing how it works helps you pick settings deliberately, edit the output by hand, and avoid a few common problems when you put blobs on a page.
Points around a circle
Start with a circle. Pick a number of points spaced evenly around it, then move each point inward or outward by a random amount. Joining those points with straight lines gives an irregular polygon. Joining them with smooth curves gives a blob.
GradientDeck's blob generator works this way. It uses a base radius of 80 units, centered on the origin of a viewBox that runs from -120 to 120 on both axes. Each point gets a stored random offset between -1 and 1. The point's radius is 80 plus that offset multiplied by Randomness × 0.4, so at the maximum Randomness of 60 a point can sit anywhere from 56 to 104 units from the center. Complexity sets the number of points, from 3 to 12.
Smoothing the outline with cubic Béziers
Each section of the outline, from one point to the next, is a cubic Bézier curve: the SVG C command, which takes two control points and an end point. The curve starts heading toward the first control point and arrives from the direction of the second. To make the blob smooth, the curve leaving a point has to continue in the same direction as the curve arriving at it.
The usual way to get that is to make the tangent at each point parallel to the line between its two neighbors. For the segment from point P1 to point P2, with P0 before and P3 after:
control 1 = P1 + (P2 - P0) × smoothness / 2
control 2 = P2 - (P3 - P1) × smoothness / 2Because the curve arriving at P2 and the curve leaving it both use the direction P3 minus P1, there is no corner at P2. This is the Catmull-Rom spline written as Bézier curves. At a smoothness of 1/3 the factor becomes 1/6, which is the standard Catmull-Rom result. Lower values pull the control points toward the points and flatten the curves; at 0 the control points sit on the points and you get the straight polygon. Higher values push the control points out and make each section bulge.
Here is the whole algorithm as a standalone function. It follows the same steps as the generator, and takes a seeded random function so the same seed always gives the same blob, which is useful when blobs are generated at build time or per user.
// Small seeded PRNG (mulberry32): same seed, same sequence
function seeded(seed) {
return function () {
seed |= 0;
seed = (seed + 0x6d2b79f5) | 0;
let t = Math.imul(seed ^ (seed >>> 15), 1 | seed);
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
function blobPath({ points = 6, randomness = 30, smoothness = 0.5, seed = 1 }) {
const random = seeded(seed);
const round = (n) => Math.round(n * 100) / 100;
const step = (2 * Math.PI) / points;
const pts = Array.from({ length: points }, (_, i) => {
const r = 80 + (random() * 2 - 1) * randomness * 0.4;
return [Math.cos(i * step) * r, Math.sin(i * step) * r];
});
let d = "M " + round(pts[0][0]) + "," + round(pts[0][1]);
for (let i = 0; i < points; i++) {
const p0 = pts[(i - 1 + points) % points];
const p1 = pts[i];
const p2 = pts[(i + 1) % points];
const p3 = pts[(i + 2) % points];
const k = smoothness / 2;
const c1 = [p1[0] + (p2[0] - p0[0]) * k, p1[1] + (p2[1] - p0[1]) * k];
const c2 = [p2[0] - (p3[0] - p1[0]) * k, p2[1] - (p3[1] - p1[1]) * k];
d += " C " + [c1, c2, p2].map((p) => round(p[0]) + "," + round(p[1])).join(" ");
}
return d + " Z";
}
const d = blobPath({ points: 7, randomness: 40, seed: 42 });
// <svg viewBox="-120 -120 240 240"><path d={d} fill="#E84A5F" /></svg>Randomness versus smoothness
The three settings interact, and the same Randomness value looks very different at different point counts.
- Few points (3 to 5) with moderate randomness give the calm, pebble-like shapes that work best behind content. With 3 points and high smoothness the shape reads as a rounded triangle.
- Many points (9 to 12) with high randomness give a wobbly, splashy outline, because neighboring points can differ in radius by up to 48 units while being only 30 degrees apart.
- At high smoothness, uneven neighbors make the curves overshoot, so parts of the outline bulge past the points that define them. If a blob has an odd lump, lowering smoothness slightly usually fixes it without changing the overall shape.
- Randomness 0 gives a circle-like shape regardless of point count, since every point is at radius 80. At smoothness 0.33 with many points it is very close to a true circle.
Since the generator stores the random offsets separately from the sliders, moving Randomness or Smoothness reshapes the same blob rather than rolling a new one. That makes it practical to find a shape you like with Shuffle and then tune how lumpy and how rounded it is. Changing Complexity creates new points, so it starts a new shape.
Using a blob as a background
The simplest placement is an inline SVG positioned behind the content. Let it overflow the container edge for a less boxed-in look, and clip with overflow: hidden on the section.
<section class="feature">
<svg class="feature-blob" viewBox="-120 -120 240 240" aria-hidden="true">
<path d="M 87.44,0 C 86.9,33.08 69.3,46.43 ... Z" fill="#E84A5F" />
</svg>
<div class="feature-content">...</div>
</section>.feature {
position: relative;
overflow: hidden;
isolation: isolate;
}
.feature-blob {
position: absolute;
z-index: -1;
width: min(70vw, 640px);
top: -15%;
right: -10%;
opacity: 0.25;
}You can also use the SVG as a CSS background image, either from a file or a data URI. In a data URI, encode # as %23 (so fill="%23E84A5F"), or the browser treats the rest of the string as a URL fragment and the image fails to load. Background SVGs cannot be styled from the page's CSS, so inline SVG is the better choice when the color should follow a theme; set fill="currentColor" and control it with color.
A large blur on a blob makes a soft glow, but filter: blur() over a big area is relatively expensive to paint and should not be animated. A radial gradient often gives a similar glow more cheaply; see the mesh gradient article for that approach.
Gradient fills
Define a gradient in the SVG's defs and reference it from fill. gradientUnits defaults to objectBoundingBox, so 0 and 1 refer to the edges of the blob's bounding box, not the viewBox.
<svg viewBox="-120 -120 240 240" aria-hidden="true">
<defs>
<linearGradient id="hero-blob-fill" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#F67280" />
<stop offset="1" stop-color="#6C5B7B" />
</linearGradient>
</defs>
<path d="M 87.44,0 C 86.9,33.08 ... Z" fill="url(#hero-blob-fill)" />
</svg>IDs in inline SVG share the page's ID namespace. If two inline SVGs both define id="gradient", every url(#gradient) points at the first one, and if that SVG is hidden with display: none, the gradient can disappear everywhere. Give each gradient a unique ID; in React, build it from useId().
Blobs as masks and clip paths
To crop a photo or avatar into a blob, the most flexible option is a CSS mask with the SVG file. The mask scales with the element like any background image.
.avatar {
width: 240px;
aspect-ratio: 1;
object-fit: cover;
mask-image: url("/shapes/blob.svg");
mask-size: contain;
mask-repeat: no-repeat;
mask-position: center;
}clip-path: path("M ...") looks like the obvious choice, but path() coordinates are in pixels of the element's box and do not scale. The generator's coordinates are centered on 0,0 and include negative values, so pasted as-is the shape would sit mostly off the top-left of the element. If you want a clip path, use an SVG clipPath with clipPathUnits="objectBoundingBox", where coordinates run from 0 to 1. To convert, add 120 to each coordinate and divide by 240, or let a tool such as SVGO transform the path.
Masks also give soft edges: a blob with a blurred edge or a gradient fill that fades to transparent produces a feathered crop, which clip-path cannot do.
Accessibility
Almost every blob is decoration. Make sure assistive technology skips it:
- Inline SVG: add aria-hidden="true". It hides the SVG and everything inside it, so no title or label is needed.
- As an image: <img src="/shapes/blob.svg" alt="">. The empty alt marks it as decorative.
- As a CSS background or mask: nothing to do; it is not in the accessibility tree.
- If a blob does carry meaning, for example a shape in a chart legend, give the SVG role="img" and an aria-label that says what it represents.
Text that overlaps a blob needs to meet contrast against the blob color and the page background, since the edge will fall somewhere across a line. Keep blobs light enough, or keep text off them. If a blob morphs or drifts, stop that motion when reduced motion is requested.
File size
A six-point blob from the generator is 347 bytes of SVG, and each extra point adds a curve of about 40 characters. That is small enough to inline without thinking about it. Two ways to make it smaller if you have many:
- Round coordinates further. The generator keeps two decimals; in a 240-unit viewBox shown at a few hundred pixels, one decimal or whole numbers look the same.
- Run it through SVGO, which can switch to relative commands and drop redundant spaces. Gzip and Brotli also compress repeated path syntax well.
If you animate between two blobs with SMIL or a JavaScript library, both paths need the same number and type of commands. Blobs from the generator always use one M and one C per point, so two blobs with the same Complexity can be interpolated directly. SMIL animations do not respond to prefers-reduced-motion on their own; pause them from JavaScript with the SVG element's pauseAnimations() method when the setting is on.
Related: mesh gradients from radial layers for soft color fields, and designing for reduced motion if your blobs move.
Making one with the GradientDeck blob generator
The blob generator has three sliders: Complexity (3 to 12 points), Randomness (0 to 60) and Smoothness (0 to 0.5). Shuffle picks a new point count, new offsets, a Randomness up to 60 and a Smoothness between 0.1 and 0.5. Choose a color from the swatches or set a custom one with the color input.
The output is a minimal SVG: one path with a solid fill, in a viewBox of -120 -120 240 240, with coordinates rounded to two decimals. Copy SVG puts that markup on the clipboard and Download saves it as blob.svg. To use a gradient, add the defs block shown above and change the fill; to make the color themeable, change the fill to currentColor. Add aria-hidden="true" when you inline it.