CSS text stroke generator — outlined and hollow lettering

Choose a stroke width and colour, decide whether the letters are hollow or filled, and copy the .outlined rule with -webkit-text-stroke and, if you want it, paint-order so the stroke sits behind the fill.

Live demo · real result from this tool

Press Generate to create a result.

Processed on your device — nothing is uploaded.

How to use the CSS text stroke generator

  1. Type the Text to preview and set the Font size (16–200 px) and Weight (400, 700 or 900).
  2. Set the Stroke width (0.5–12 px) and Stroke colour.
  3. Keep Transparent fill ticked for hollow letters, or untick it and choose a Fill colour.
  4. Leave Stroke behind the fill (paint-order) ticked for filled text with a cleaner outline.
  5. Copy the .outlined rule.

What it does and when to use it

A text stroke draws a line around each letter. Hollow outlined words are popular in posters, sports graphics and large hero headings, often stacked with a solid version of the same word. Filled text with a dark stroke is the classic meme or comic caption look, and it keeps white text readable over a photo.

For a softer edge or glow instead of a hard line, use the text shadow generator. To check that the stroke colour stands out from your background, use the contrast checker, and for gradient-filled headings try the CSS gradient generator.

How it works

The rule sets the size, weight and fill colour (transparent for hollow text), then -webkit-text-stroke: <width> <colour>. When Stroke behind the fill is ticked it adds paint-order: stroke fill;. MDN notes that for HTML text, paint-order can only choose the order of stroke and fill, and lists it as Baseline widely available since March 2024.

Worked examples

Default hollow heading, 96 px, weight 900:

.outlined {
  font-size: 96px;
  font-weight: 900;
  color: transparent;
  -webkit-text-stroke: 2px #0f172a;
  paint-order: stroke fill;
}

With a transparent fill, the paint-order line has no visible effect, so you can drop it.

Caption-style white text. Fill #ffffff, stroke 4 px #000 (written back as #000000), size 72 px: the rule gets color: #ffffff;, -webkit-text-stroke: 4px #000000; and paint-order: stroke fill;. With paint-order, the fill covers the inner half of the stroke, so roughly 2 px of outline shows outside the letters and the letters stay full width.

A fine red outline, 1 px #e11d48, weight 700, 48 px, hollow, paint-order off: color: transparent; and -webkit-text-stroke: 1px #e11d48;. Thin strokes on lighter weights can look faint, so check them at real size.

Limits and tips

  • Strokes grow inwards too. Without paint-order, a wide stroke on thin letters can fill in small gaps such as the holes in “e” and “a”.
  • Very wide strokes suit heavy fonts at large sizes; at body sizes they turn letters into blobs.
  • Selecting hollow text still copies the real characters, so search and copy-paste work normally.

Frequently asked questions

Why does the property have a -webkit- prefix?
That is its name. -webkit-text-stroke is the property MDN documents for outlining HTML text, and despite the prefix MDN lists it as Baseline widely available since April 2017. The generator writes only this version.
What does "Stroke behind the fill" do?
It adds paint-order with stroke first, then fill. The stroke is drawn on the letter outline, partly over the inside of each letter, so drawing the fill on top hides that inner part and keeps thin letter shapes open. It only matters when the fill is visible.
Why do my hollow letters look broken where strokes overlap?
Some fonts build letters from overlapping shapes, and the stroke traces every shape, so you see lines crossing inside a letter. Try another font or a heavier weight.
Is hollow text accessible?
Hollow text has much less ink than solid text, so it is harder to read, especially small or on busy backgrounds. Keep it for large display headings and make sure the stroke colour contrasts well with the background.
Can I add a shadow too?
Yes. text-shadow works alongside the stroke. Create one with the text shadow generator and add the line to the same rule.

Sources

  1. -webkit-text-stroke - CSS | MDN — MDN Web Docs, accessed 2026-10-08
  2. paint-order - CSS | MDN — MDN Web Docs, accessed 2026-10-08

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close