CSS HALFTONE GENERATOR
Build a halftone dot pattern with a fade in pure CSS, then copy it.
In short
Build a halftone dot pattern in pure CSS — choose dot size, spacing, colors, an optional offset second grid, and a fade direction — and copy the CSS. It uses radial-gradient and mask-image, so no image file is needed, and it runs in your browser with no upload.
.halftone {
position: relative;
background-color: #201d19;
}
.halftone::before {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
background-image: radial-gradient(circle, #ff6a35 4px, transparent 4.5px), radial-gradient(circle, #ff6a35 4px, transparent 4.5px);
background-size: 16px 16px;
background-position: 0 0, 8px 8px;
-webkit-mask-image: linear-gradient(to bottom, transparent, #000);
mask-image: linear-gradient(to bottom, transparent, #000);
}Example output (default settings)
<div class="halftone">
<!-- your content here -->
</div>.halftone {
position: relative;
background-color: #201d19;
}
.halftone::before {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
background-image: radial-gradient(circle, #ff6a35 4px, transparent 4.5px), radial-gradient(circle, #ff6a35 4px, transparent 4.5px);
background-size: 16px 16px;
background-position: 0 0, 8px 8px;
-webkit-mask-image: linear-gradient(to bottom, transparent, #000);
mask-image: linear-gradient(to bottom, transparent, #000);
}How to build a CSS halftone pattern
- 1
Set the dot spacing and dot size to control how coarse the halftone looks.
- 2
Pick the dot color and background color.
- 3
Turn on the offset grid for a denser, staggered screen, and choose a fade direction if you want the dots to dissolve.
- 4
Copy the CSS and HTML and drop them into your page.
Questions
- How is the halftone drawn without an image?
- A radial-gradient paints one solid circle with a hard edge, and background-size repeats it as a tile. The spacing value is the tile size, and the dot size is the circle radius inside it.
- What does the offset grid do?
- It adds a second copy of the dot layer shifted by half the spacing in both directions. The dots then sit in a staggered, diagonal arrangement like a classic print screen, with twice the dot density.
- How does the fade work?
- The dots live on a ::before layer that gets a mask-image gradient. Where the mask is opaque the dots show fully, and where it is transparent they disappear. The dots do not shrink, they fade out. True size-graded halftone would need an image or SVG.
- Can I put text or images on top of the pattern?
- Yes. The dot layer is a pseudo-element with pointer-events: none, so anything you place inside the .halftone container stays clickable. If content ends up underneath the dots, give it position: relative and a z-index of 1.
- Does it work in all browsers?
- Radial gradients and background-size work everywhere. mask-image is supported in current browsers, and the CSS includes the -webkit- prefixed version for older Safari and Chromium releases.
Related tools
- CSS Pattern GeneratorDesign a repeating background pattern — dots, grid, stripes, checkerboard, diagonal — and copy the CSS.
- CSS Starfield / Dots GeneratorScatter hundreds of points from a single box-shadow into a drifting, parallax starfield background and copy the CSS.
- CSS CRT / Scanlines / VHS GeneratorBuild a retro CRT screen overlay with scanlines, vignette, phosphor tint, and flicker animation, then copy the CSS.
- CSS Wave & Shape Divider GeneratorBuild a wave, curve, slant, zigzag, or arc divider between page sections with an inline SVG and copy the HTML and CSS.
- CSS Clip-Path GeneratorDrag points on a live preview to build a clip-path: polygon() shape from a preset or from scratch, and copy the CSS.
- Aurora Background GeneratorCreate a drifting northern-lights background from blurred, animated color blobs blended with mix-blend-mode.
- CSS Gradient Border GeneratorBuild a rounded gradient border with 2-5 color stops using the padding-box/border-box trick, and copy the CSS.
- Mesh Gradient GeneratorBlend several soft color blobs into a mesh-style gradient background using layered radial-gradient().
Updated