Free CSS Text Stroke Generator

Create outlined and stroked text effects with live preview and ready-to-copy CSS code.

Controls

Preview

Generated CSS


      
    

How It Works

  1. Enter your text: type the text you want to preview with a stroke effect.
  2. Adjust stroke settings: set stroke width (in pixels), stroke color, text color, font size, and font family.
  3. Copy the CSS: the generated -webkit-text-stroke and text-stroke CSS properties appear ready to copy into your stylesheet.

Why Use CSS Text Stroke Generator?

CSS text stroke adds an outline around letterforms, a popular design technique for headings, logos, and display text where you want outlined or hollow letters. Building the correct CSS syntax by hand requires knowing the -webkit prefix, unit values, and color formats. This generator lets you preview the effect visually and outputs production-ready CSS code instantly.

Features

Frequently Asked Questions

Is CSS text-stroke supported in all browsers?

-webkit-text-stroke has broad support in modern browsers including Chrome, Firefox, Safari, and Edge. It remains vendor-prefixed in some contexts. Always test your target browsers and provide a fallback text-shadow if needed.

How do I make hollow outlined text?

Set the text color to transparent and add a stroke color. This creates hollow/outlined text where only the stroke is visible. Use -webkit-text-fill-color: transparent; combined with -webkit-text-stroke.

Can I use text-stroke on any font?

Yes, text-stroke works on any font. The effect is most dramatic on thick, bold fonts. Thin fonts may show the stroke overlapping the letterform at larger widths.

Where CSS text stroke came from

The idea of stroking a glyph predates CSS by decades; it is native to PostScript (Adobe, 1984) and was carried into SVG 1.1 (W3C Recommendation, 2nd Edition, 16 August 2011), which defines the stroke, stroke-width, stroke-linecap, and stroke-linejoin paint attributes for any shape including <text>. CSS got its own version when Apple shipped -webkit-text-stroke in Safari 3 in June 2007, alongside -webkit-text-fill-color. The property was never standardised in any shipping W3C spec; it lives in the CSS Text Decoration Module Level 4 Editor's Draft as unprefixed text-stroke, but as of 2026 the unprefixed name is still not enabled in any browser. Firefox 49 (20 September 2016) and Edge 15 (5 April 2017) both added -webkit-text-stroke as an explicit web-compatibility alias to handle pages that use only the WebKit-prefixed name. In production, write the prefix.

Three ways to outline text on the web

There is more than one way to draw an outline around text. The right tool depends on the width, the legibility budget, and whether the underlying glyphs need to stay sharp:

Accessibility: contrast logic, body-text-no, decorative-yes

WCAG 2.1 Success Criterion 1.4.3 «Contrast (Minimum)» (W3C Recommendation 5 June 2018) requires 4.5:1 contrast for normal text and 3:1 for large text (18 pt / 14 pt bold). With a stroke applied, the visually dominant edge of the glyph is the stroke colour, so the contrast check has to compare that colour against the background, not the fill. A common failure: a yellow logo on white with a thin black stroke passes if you check black vs. white, but the body of the letter is yellow on white and reads badly at small sizes. Strokes destroy legibility on body text. Below 16 px font size, a 1 px stroke fills 10 to 15 percent of the glyph interior and a 2 px stroke can close counters (the holes in «a», «e», «o»). Reserve text stroke for headings, display type, and decorative use; never apply it to paragraph text without explicit testing at every breakpoint.

When a text stroke is the right tool

Common mistakes

More frequently asked questions

Why does my stroke look thicker on a Retina display than on a 1080p monitor?

It does not, in CSS pixels. A 2px stroke is exactly 2 CSS pixels on both. What changes is the perceived sharpness: on a Retina (2× DPR) display, a 2 CSS pixel stroke is 4 device pixels and antialiases cleanly. On a 1× display, 2 device pixels give a noticeably blurrier edge. If you need a hairline that snaps to one device pixel on Retina, write 0.5px; browsers round to one device pixel on high-DPR screens.

Can I have a different stroke colour for each letter?

Not with a single -webkit-text-stroke declaration. Either wrap each letter in a <span> and style individually, or use SVG <tspan> elements with their own stroke attribute. The ::first-letter pseudo-element accepts text-stroke if you only need the first letter to differ.

How thick a stroke is too thick?

A practical ceiling is about 8 percent of the font-size. At 100 px font, that is 8 px stroke; beyond that the letters start to overlap each other. If you want a thicker outline visual, use SVG <text> with paint-order: stroke fill; so the fill stays at original width and the stroke extends only outward.

Does -webkit-text-stroke work on emoji?

On colour emoji (the default in modern browsers), the stroke applies to the outer silhouette of the emoji glyph. The result is usually subtle because the emoji already has its own outline and shading. For black-and-white emoji (the text font variation), the stroke applies cleanly like any other glyph.

Is anything sent to a server?

No. The text you type into the preview, the colours you choose, and the generated CSS are all processed in your browser's JavaScript. No network call is made. Open the Network tab in DevTools to verify.

Related Tools

Text Gradient Glitch Text CSS Animation Generator Text Shadow