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
- Enter your text: type the text you want to preview with a stroke effect.
- Adjust stroke settings: set stroke width (in pixels), stroke color, text color, font size, and font family.
- 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
- Live preview: see text stroke effects update in real time as you adjust settings.
- Stroke width control: set any pixel width from hairline strokes to bold outlines.
- Full color support: choose stroke and text colors with a color picker or hex input.
- Font options: preview with different font families and sizes to match your design.
- Ready-to-use CSS: output includes the -webkit-text-stroke property and standard equivalents.
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:
-webkit-text-stroke: the property this generator emits. One line of CSS, GPU-composited, free at any framerate. The stroke is drawn centered on the glyph outline, half inside and half outside, which means thick strokes start eating into the letterforms.- Four-direction
text-shadow: the universal fallback that works in every browser back to IE 10.text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;stacks four 1-pixel shadows in each corner to fake a 1 px outline. Defined in CSS Text Decoration Module Level 3 (W3C Candidate Recommendation August 2019). At wider strokes the stair-step artefacts become visible; eight or sixteen directions can smooth them at the cost of more shadows. - SVG
<text>withpaint-order: stroke fill;: the right answer when you need a thick stroke without ink bleeding inside the letterform. Thepaint-orderproperty draws the stroke first, then the fill on top, so the fill stays at its full advertised width.
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
- Comic-book and gaming UI titles: the classic Marvel / Nintendo bold-black-stroke-on-bright-fill look.
- Watermarks and decorative overlays: semi-transparent stroke only, no fill, sitting over imagery.
- Tutorial graphics, screenshots, callouts where text must stand out against an unknown background.
- «Ghost» buttons where the button text uses a stroke and transparent fill to feel weight-matched with the bordered button itself.
- Outline-only headings in editorial design, the «hollow letter» look that was big in the late-2010s.
Common mistakes
- Forgetting the
-webkit-prefix. The unprefixedtext-strokeis in Editor's Draft status only and not shipped. Always write the prefixed form in production. - Trying to animate
-webkit-text-stroke-width. It is not on the list of animatable CSS properties. Transitions will «snap» rather than tween. Animatetext-shadowor use SVG when motion is required. - Applying a stroke to small text. Below 16 px the stroke fills the glyph interior and closes letter counters. Set a minimum font-size guard with a media query.
- Combining wide strokes with tight
letter-spacing. The stroke crosses between adjacent glyphs and produces grey smudges where the shapes touch. - Counting the stroke colour as the «text colour» in contrast checks. Both the fill and the stroke must clear WCAG 1.4.3 against the background.
- Not testing print stylesheets. Strokes can render dramatically thicker or thinner when printed, especially on browsers that downscale colour gamut for PDF output.
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.