The best CRT filter depends on where the picture lives. For interface text, a few lines of CSS are enough: scanlines from repeating-linear-gradient, glow from text-shadow and a vignette. For photos and video on a web page, a small WebGL fragment shader adds what CSS cannot do well: real barrel curvature, colour fringing and grain. Emulators have mature options in RetroArch's CRT shaders, video editors have analog effects built in, and browser editors such as the HorizonX retro CRT effects export a finished still or clip.
This guide breaks the CRT look into its parts, then builds two versions you can copy. What was tested, on 2026-11-09: the CSS passed csstree-validator 4.0.1, the JavaScript passed node --check on Node 24, and both demos rendered in headless Chromium with no console errors. Nothing beyond that was measured, so check them in the browsers you support.
What makes something look like a CRT
A CRT look is a stack of small defects, not one filter. Convincing versions use four or five of them and keep each one subtle.
| Ingredient | What it imitates | How to fake it |
|---|---|---|
| Scanlines | The gaps between the horizontal lines the beam drew | Dark horizontal bands every 2 to 4 pixels |
| RGB subpixel mask | Phosphor dots or stripes (shadow mask, aperture grille) | Faint red, green and blue columns multiplied over the image |
| Bloom or glow | Bright phosphors bleeding into their neighbours | A blurred copy of the bright parts added on top; text-shadow for text |
| Barrel curvature | The bulging glass of the tube | Push pixels outward with distance from the centre (needs a shader) |
| Vignette | Darker corners | A radial gradient from transparent to black |
| Chromatic aberration | Beams slightly out of convergence | Red and blue sampled a pixel or two apart |
| Flicker | Brightness instability | A slow, small opacity drift (see the accessibility notes) |
| Noise | Analog signal noise | Random grain that changes every frame |
The libretro documentation describes CRT shaders with the same parts: scanlines, a phosphor mask, some blurring, sometimes curvature, and glow or halation for bloom (libretro CRT shaders, checked 2026-11-09).
Which CRT filter to use
| Where the effect lives | Good fit | Why |
|---|---|---|
| Interface text, terminals, headings | CSS overlay | No JavaScript; the text stays real, selectable and readable by screen readers |
| Photos, video or canvas on a web page | WebGL fragment shader | Per-pixel control: curvature, aberration, grain |
| Retro games in an emulator | RetroArch CRT shaders | Many tuned options, free |
| Edited video | DaVinci Resolve Studio Analog Damage, Red Giant Universe Analog | Presets, keyframes, render to a file |
| A still or clip for a post, cover or deck | A browser editor such as HorizonX Phosphor Bloom | Tune by eye and export a file, no code |
The CSS, the shader below and RetroArch cost nothing. Analog Damage needs the paid Studio version of Resolve, Universe is a paid plugin suite, and HorizonX is a paid subscription.
Build a CRT effect in CSS for UI text
This version suits terminal-style panels, headings and small UI areas. The text stays in the DOM.
<div class="crt">
<p>READY.</p>
<p>LOAD "*",8,1</p>
</div>
.crt {
position: relative;
overflow: hidden;
padding: 2rem 2.5rem;
border-radius: 1.5rem;
background: #07140b;
color: #8dffb0;
font: 1.25rem/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.crt p {
margin: 0;
text-shadow:
0 0 2px rgb(141 255 176 / 0.8),
0 0 14px rgb(141 255 176 / 0.4),
-1px 0 rgb(255 70 70 / 0.35),
1px 0 rgb(70 170 255 / 0.35);
}
.crt::before,
.crt::after {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
}
.crt::before {
background:
repeating-linear-gradient(to bottom, transparent 0 2px, rgb(0 0 0 / 0.3) 2px 3px),
repeating-linear-gradient(to right, rgb(255 0 0 / 0.06) 0 1px, rgb(0 255 0 / 0.06) 1px 2px, rgb(0 0 255 / 0.06) 2px 3px);
}
.crt::after {
background: radial-gradient(ellipse at center, transparent 55%, rgb(0 0 0 / 0.6));
}
@keyframes crt-drift {
50% { opacity: 0.94; }
}
@media (prefers-reduced-motion: no-preference) {
.crt p { animation: crt-drift 2.4s ease-in-out 2; }
}
How each part works:
- Scanlines and mask. The
::beforelayer holds two repeating linear gradients. The first draws a dark 1px line every 3px. The second draws 1px red, green and blue columns at 6% opacity, a rough aperture-grille mask that tints rather than stripes. - Glow and fringing.
text-shadowtakes a list. Here it stacks a tight glow, a wide glow and two 1px offsets in red and blue for a hint of chromatic aberration. - Vignette and corners.
::afterdarkens the edges with a radial gradient, andborder-radiuswithoverflow: hiddenrounds the tube. - Clicks and selection. Both overlays use
pointer-events: none, so links and text selection still work underneath. - Flicker. The text dims to 94% twice over 4.8 seconds and stops, and only when the visitor has not asked for less motion (
prefers-reduced-motion).
Accessibility: flicker and contrast
Do not reproduce real CRT flicker. WCAG 2.2 success criterion 2.3.1 Three Flashes or Below Threshold (Level A) forbids content that flashes more than three times in any one-second period, unless the flashes stay below the general and red flash thresholds, and a fast full-panel flicker is exactly that. Criterion 2.2.2 Pause, Stop, Hide (Level A) asks for a way to pause moving content that starts on its own and lasts more than five seconds. The drift above is slow, finite and under five seconds. If you want it to loop, add a pause control.
Check contrast with the effect on. Using the WCAG relative luminance formula, #8dffb0 on #07140b works out to about 15.3:1, and the text colour darkened 30% by a scanline is still about 7.3:1, above the 4.5:1 that 1.4.3 Contrast (Minimum) asks of normal text. Amber or blue phosphor palettes drop faster, so recompute when you change colours.
For more ways to layer glow on text and buttons, see the CSS glow effect guide.
What CSS cannot do well
CSS can suggest curvature with rounded corners and a vignette, but it cannot bend the content like curved glass. An SVG displacement filter can warp an element, but it is fiddly to tune. For a real curved screen over an image or video, use the shader.
Build a CRT filter in WebGL for images and video
A fragment shader runs once per output pixel, so it can bend the picture, split colour channels and add moving grain. The module below is plain WebGL 1 with no library. createCrt(canvas, source) draws an <img> or <video> through the effect and returns false when WebGL is not available.
Markup and layout: the canvas sits on top of the original media, so the image and its alt text stay in the page. If WebGL fails, the canvas stays transparent and the plain image shows.
<div class="crt-media">
<img id="photo" src="/media/arcade.jpg" alt="Arcade cabinet glowing in a dark room">
<canvas id="crt" aria-hidden="true"></canvas>
</div>
.crt-media {
position: relative;
aspect-ratio: 4 / 3;
}
.crt-media img,
.crt-media canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
}
import { createCrt } from "./crt-gl.js";
const img = document.getElementById("photo");
await img.decode();
createCrt(document.getElementById("crt"), img);
The module, crt-gl.js:
const VERTEX = `
attribute vec2 a_position;
varying vec2 v_uv;
void main() {
// Clip space -1..1 to texture space 0..1, flipped so the image is upright
v_uv = vec2(a_position.x, -a_position.y) * 0.5 + 0.5;
gl_Position = vec4(a_position, 0.0, 1.0);
}
`;
const FRAGMENT = `
precision mediump float;
uniform sampler2D u_image;
uniform vec2 u_texel; // 1.0 / source size in pixels
uniform float u_time; // seconds
uniform float u_motion; // 1.0 = animate, 0.0 = reduced motion
varying vec2 v_uv;
const float CURVATURE = 0.10;
const float ABERRATION = 0.002;
const float GLOW = 0.35;
const float SCANLINES = 0.30;
const float MASK = 0.18;
const float VIGNETTE = 0.45;
const float NOISE = 0.035;
vec2 barrel(vec2 uv) {
vec2 c = uv * 2.0 - 1.0;
c *= 1.0 + CURVATURE * dot(c, c);
return c * 0.5 + 0.5;
}
float hash(vec2 p) {
return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
}
void main() {
vec2 uv = barrel(v_uv);
if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
return;
}
// Chromatic aberration: red and blue drift apart toward the edges
vec2 shift = (uv - 0.5) * ABERRATION;
vec3 color = vec3(
texture2D(u_image, uv + shift).r,
texture2D(u_image, uv).g,
texture2D(u_image, uv - shift).b
);
// Cheap glow: add the bright parts of four nearby samples
vec2 o = u_texel * 2.0;
vec3 around = texture2D(u_image, uv + vec2(o.x, 0.0)).rgb
+ texture2D(u_image, uv - vec2(o.x, 0.0)).rgb
+ texture2D(u_image, uv + vec2(0.0, o.y)).rgb
+ texture2D(u_image, uv - vec2(0.0, o.y)).rgb;
color += GLOW * max(around * 0.25 - 0.5, 0.0);
// Scanlines: a dark band every 3 device pixels
float line = 0.5 + 0.5 * cos(gl_FragCoord.y * 2.0943951);
color *= 1.0 - SCANLINES * line;
// Aperture-grille mask: red, green and blue columns
float column = mod(floor(gl_FragCoord.x), 3.0);
vec3 mask = vec3(1.0 - MASK);
if (column < 1.0) {
mask.r = 1.0;
} else if (column < 2.0) {
mask.g = 1.0;
} else {
mask.b = 1.0;
}
color *= mask;
// Vignette, slow brightness drift and grain
vec2 c = uv - 0.5;
color *= 1.0 - VIGNETTE * dot(c, c) * 2.0;
color *= 1.0 - u_motion * 0.03 * (0.5 + 0.5 * sin(u_time * 2.0));
float frame = floor(u_time * 24.0) * u_motion;
color += NOISE * (hash(gl_FragCoord.xy + frame) - 0.5);
gl_FragColor = vec4(clamp(color, 0.0, 1.0), 1.0);
}
`;
function compile(gl, type, source) {
const shader = gl.createShader(type);
gl.shaderSource(shader, source);
gl.compileShader(shader);
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
throw new Error(gl.getShaderInfoLog(shader));
}
return shader;
}
export function createCrt(canvas, source) {
const gl = canvas.getContext("webgl");
if (!gl) return false; // keep showing the plain image or video
const program = gl.createProgram();
gl.attachShader(program, compile(gl, gl.VERTEX_SHADER, VERTEX));
gl.attachShader(program, compile(gl, gl.FRAGMENT_SHADER, FRAGMENT));
gl.linkProgram(program);
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
throw new Error(gl.getProgramInfoLog(program));
}
gl.useProgram(program);
// One triangle that covers the whole canvas
gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer());
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 3, -1, -1, 3]), gl.STATIC_DRAW);
const position = gl.getAttribLocation(program, "a_position");
gl.enableVertexAttribArray(position);
gl.vertexAttribPointer(position, 2, gl.FLOAT, false, 0, 0);
// Non-power-of-two images need clamping and no mipmaps in WebGL 1
gl.bindTexture(gl.TEXTURE_2D, gl.createTexture());
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
const uTexel = gl.getUniformLocation(program, "u_texel");
const uTime = gl.getUniformLocation(program, "u_time");
const uMotion = gl.getUniformLocation(program, "u_motion");
const reduceMotion = matchMedia("(prefers-reduced-motion: reduce)");
const isVideo = source instanceof HTMLVideoElement;
let uploaded = false;
function draw(now) {
const dpr = Math.min(window.devicePixelRatio || 1, 2);
const width = Math.round(canvas.clientWidth * dpr);
const height = Math.round(canvas.clientHeight * dpr);
if (canvas.width !== width || canvas.height !== height) {
canvas.width = width;
canvas.height = height;
}
gl.viewport(0, 0, width, height);
if (isVideo ? source.readyState >= 2 : !uploaded) {
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, source);
uploaded = true;
}
const w = isVideo ? source.videoWidth : source.naturalWidth;
const h = isVideo ? source.videoHeight : source.naturalHeight;
gl.uniform2f(uTexel, 1 / Math.max(w, 1), 1 / Math.max(h, 1));
gl.uniform1f(uTime, now / 1000);
gl.uniform1f(uMotion, reduceMotion.matches ? 0 : 1);
gl.drawArrays(gl.TRIANGLES, 0, 3);
if (isVideo || !reduceMotion.matches) requestAnimationFrame(draw);
}
requestAnimationFrame(draw);
return true;
}
What the shader does, in order
- Curvature.
barrel()pushes each sample outward in proportion to its squared distance from the centre, and paints black outside the curved edge.CURVATUREat 0.10 gives a gentle bulge. - Chromatic aberration. Red and blue are read slightly outward and inward, so colour fringes grow toward the corners.
- Glow. Four samples two source pixels away are averaged, and only the part above mid-grey is added back, so bright areas bleed and dark ones do not.
- Scanlines and mask. Both are tied to device pixels through
gl_FragCoord: a dark band every 3 pixels and a repeating red, green and blue column. - Vignette, drift and grain. Grain changes 24 times a second. Under reduced motion, drift and grain freeze, and a still image is drawn once instead of on every frame.
Practical notes
- Same-origin media. WebGL can only read pixels from same-origin images and video, or from cross-origin files served with CORS and loaded with
crossorigin(MDN on CORS-enabled images). - Image sizes. WebGL 1 accepts non-power-of-two images only with
CLAMP_TO_EDGEwrapping and no mipmaps, which is why the texture is set up that way (MDN, Using textures in WebGL). - Video. A video texture has to be uploaded again on every frame, which the draw loop does once the video has data (MDN, Animating textures in WebGL). The canvas covers the native controls, so give the page its own play and pause button; autoplaying video longer than five seconds needs one under WCAG 2.2.2 anyway.
- Pixel art. Scanlines tied to device pixels ignore the source grid. For pixel art, tie them to source rows instead, with one dark band per row:
float line = 0.5 + 0.5 * cos(uv.y / u_texel.y * 6.2831853);. Switch the texture filters togl.NEARESTand scale by whole numbers. The libretro docs make the same point: CRT shaders look better with integer scaling (libretro shader introduction). - Fallback. If you use this as a hero background, keep a static image for devices without WebGL; this guide to WebGL backgrounds with a static fallback covers the pattern in React.
CRT filters in video editors and existing tools
DaVinci Resolve. The Resolve 20 reference manual lists Analog Damage under Resolve FX Texture as a Studio-only effect. Its controls are grouped into Telecine Source, Broadcast Signal (noise, ghosting, chroma misalignment), Scan, Scan Lines, TV Construction (phosphor brightness and tint, defocus, screen curvature, edge mask) and VHS, with presets. The manual calls the older Fusion TV node mostly obsolete next to it (DaVinci Resolve 20 Reference Manual, checked 2026-11-09).
Red Giant Universe Analog (Maxon). It offers scan line directions including TV CRT and PC CRT, a scan line scale and presets in the Universe dashboard (Maxon help, checked 2026-11-09). Universe is a paid suite.
RetroArch and libretro shaders. For games, these are the reference. The libretro docs describe crt-geom as the original CRT shader, still good at non-integer scales; crt-royale as a demanding shader with dozens of options that shines at 1440p and above; crt-lottes as a good general choice at default settings; and zfast-crt and crt-pi for weak or mobile GPUs (libretro CRT shaders, checked 2026-11-09). If you port one into your own project, check that shader's licence first.
Any layer-based image editor. The manual version works anywhere: a scanline pattern layer on Multiply, a blurred copy of the image on Screen for bloom, the red channel nudged a pixel sideways, a vignette, and a lens or spherize distortion applied last for curvature.
HorizonX. The retro CRT effects collection holds 11 browser effects (checked 2026-11-09). The closest to a classic tube is Phosphor Bloom. It lays a fine RGB phosphor grid, slight curvature, a pale green tint and a soft window reflection over an image or video. Its controls are grid size, curvature, zoom, window shape, screen tint, contrast and brightness. On video, the grid and reflection stay fixed while the footage plays. Jumbotron is a different take: glowing rows of marks like a stadium screen, with scanline and glow controls. Stills export as PNG or JPEG and motion as MP4 or a PNG sequence. Anyone can open and adjust the effects; exporting is part of the paid plans, which start at $24.99 a month (checked 2026-11-09).
Limits worth knowing: Phosphor Bloom showed no flicker or noise control when checked, and these effects export files, not code for your site. For a live effect on a page, use the CSS or the shader above.
Tuning tips that keep it readable
- Start subtle. The snippets use scanlines at 30% and a mask at 18% or less. Go darker only if the image survives it, because heavy scanlines and masks darken the whole picture.
- Do not resample the result. Scanlines and masks are fine repeating patterns, and scaling them with CSS transforms, browser zoom or a downscaled screenshot creates moiré. Render at the size you display.
- Respect device pixel ratio. The shader sizes its canvas by
devicePixelRatio, capped at 2, so 3-pixel scanlines stay sharp on high-density screens without running the shader on millions of extra pixels. - Preview the final export. Grain and 1-pixel lines are the kind of fine detail video compression smooths away. Look at the exported file at its delivery bitrate before you judge the effect.
- Keep text real. Put the effect on top of live text or behind it; do not bake interface copy into a canvas.
FAQ
What is the best CRT filter?
There is no single best one. Use CSS for UI text, a WebGL shader for images and video on a web page, RetroArch shaders for emulation, Resolve Studio or Universe for edited video, and a browser editor such as HorizonX when you want an exported still or clip without code.
How do I add scanlines in CSS?
Put a repeating-linear-gradient on an absolutely positioned pseudo-element over the content, for example transparent 0 2px, rgb(0 0 0 / 0.3) 2px 3px, and set pointer-events: none so it does not block clicks.
Can I make a CRT effect without JavaScript?
Yes, the CSS version above uses none. You get scanlines, a mask, glow, vignette and a gentle drift. True barrel curvature over an image needs a shader.
Is there a free CRT filter?
Yes. The CSS and shader in this guide, RetroArch's shaders, and the manual layer method all cost nothing. Analog Damage is not in the free version of Resolve, and HorizonX is a paid subscription.
Next step
Pick the version that matches where the effect will live, keep the reduced-motion handling with it, and check contrast with the effect on. To tune a CRT look by eye on your own image or clip and export it, try Phosphor Bloom.