Text Shadow Generator

Shadow value—
Offset—
Blur radius—

How Text Shadow Generator is calculated: text-shadow: offset-x offset-y blur-radius colour — for example, 2px 2px 4px #333333 moves the shadow 2px right and down with a 4px blur.

What is a text shadow generator?

A text shadow generator builds the CSS code that puts a shadow behind text. Set the horizontal offset, the vertical offset, the blur, and the colour, and you get a line of CSS ready to paste into your stylesheet. The default here is a shadow 2 pixels right and 2 pixels down, with a 4-pixel blur in dark grey — the value reads "2px 2px 4px #333333".

Shadows make text readable and give it depth. White text on a photo is hard to read until a dark shadow sits behind it; a heading on a plain background looks flat until a soft shadow lifts it off the page. Designers use shadows on hero headings, buttons, and captions every day.

This tool is different from the box shadow generator on this site, which styles boxes and cards. Text shadow works on the letters themselves, following the shape of each character, while a box shadow follows the rectangle around an element. Use this one for headings and text, the other one for cards and buttons.

A shadow is also a way to fake depth on a flat page. A small dark shadow below and to the right of the text makes the letters look raised, as if light were coming from the top left, and a light shadow on a dark background makes the letters look engraved instead. The effect is cheap — one line of CSS — and it works in every browser, which is why it is still used when newer effects are available. The generator exists because the four numbers in a text-shadow value are easy to get wrong by hand, and the preview shows the mistake at once.

How a text shadow works

The CSS property is text-shadow, and it takes four values in order: the horizontal offset, the vertical offset, the blur radius, and the colour. The default of 2px 2px 4px #333333 means the shadow sits 2 pixels to the right of each letter, 2 pixels below it, spreads over 4 pixels, and is coloured #333333, a dark grey.

The offsets move the shadow. A positive horizontal offset pushes it right; a negative one pushes it left. A positive vertical offset pushes it down; a negative one pushes it up. Set both to 0 and the shadow sits directly behind the text, which makes a glow effect when the blur is large — useful for neon-style headings.

The blur softens the shadow. A blur of 0 gives a hard edge, like a second copy of the text in the shadow colour. A blur of 4 pixels, as in the default, gives a soft edge that reads as a real shadow. Larger blurs fade the shadow out, which suits big display headings. The colour can be any hex value, or a named colour such as red or black.

Offsets and blur, explained with numbers

Small numbers suit body text and small headings. An offset of 1 pixel with a blur of 1 pixel is barely visible, but it is enough to separate white text from a light photo. The default — 2 pixels right, 2 pixels down, 4 pixels of blur — is the most common shadow on the web, and it suits headings from 20 to 48 pixels tall.

Large numbers suit display type. A heading at 72 pixels tall can take an offset of 6 pixels and a blur of 12 pixels without looking heavy. The rule is proportion: the shadow should be roughly a tenth of the text height. A shadow bigger than the letters looks like a mistake; a shadow smaller than a pixel is invisible.

Negative offsets are useful too. An offset of -2 pixels up and left, with a dark shadow, makes text look engraved; the same offset with a light shadow on a dark background makes it look raised. Try -2, -2, 2, and a light grey on a dark heading to see the engraved effect.

The blur number deserves a second look, because it changes the shadow more than the offsets do. A blur of zero gives a hard edge that looks like a second copy of the text, offset by a few pixels, and that is the look of a drop shadow in a poster. A blur of four to eight pixels softens the edge until the shadow reads as a glow rather than a copy, which is the look that helps white text sit on a photograph. A blur above twelve pixels spreads the shadow so thin that it fades into the background, and the text is left with no help at all.

A worked example: white text on a photo

Take a hero heading in white over a bright photo. Without a shadow, the white letters vanish into the bright parts of the image. Add the default shadow — 2px 2px 4px #333333 — and each letter gains a dark edge that separates it from the photo. The shadow is subtle, but the heading becomes readable at a glance.

For a stronger effect, raise the blur to 8 pixels and keep the offsets at 2 and 2. The shadow spreads further, which softens the edge between the letters and the photo. For a hard retro effect, set the blur to 0 and the offsets to 4 and 4: the shadow becomes a solid copy of the text, offset down and right, which is the classic 1980s poster look.

The CSS for the default is one line: "text-shadow: 2px 2px 4px #333333;". Paste it into the rule for your heading, and it applies to every heading with that class. Change the colour to match the photo — a dark blue shadow suits a sky photo better than a grey one.

Who uses a text shadow generator, and why

Web designers are the main users. A hero heading, a caption over an image, or a button label all need shadows in the right places, and guessing the numbers by hand means editing CSS and refreshing the page for each try. A generator gives the numbers and the code in one place.

Bloggers and small business owners are the second group. A shop owner making a sale banner, or a blogger styling a quote, needs a shadow that looks good without learning CSS. The sliders on this page make it a matter of dragging until it looks right, then copying one line.

Developers are a third group, and they use it for speed. Knowing the syntax is one thing; getting the numbers right for a particular font size is another. A box shadow generator covers cards and buttons in the same way, so the two tools together handle most of the shadows on a page.

Text shadow vs box shadow and other tools

Text shadow follows the letters; box shadow follows the box. A box shadow generator puts a shadow behind the rectangle of a card or a button, which is what you want for a card floating over a page. Text shadow puts the shadow behind each character, which is what you want for a heading floating over a photo.

The two are often used together: a card with a box shadow, holding a heading with a text shadow. The card looks lifted, and the heading looks readable. Use them separately and each one is subtle; use them together and the page gains depth without any images.

Colour tools complete the set. A colour picker gives the exact hex value for a shadow colour that matches a photo, and a colour palette generator builds a matching set of colours for the page — combine a well-chosen palette with a soft dark shadow and the text reads clearly on almost any background.

Common text shadow mistakes

The first mistake is a shadow that is too strong. A black shadow with no blur at a large offset looks like a printing error, not a design choice. Start with the default — 2, 2, 4, dark grey — and increase the numbers slowly. A shadow should be noticed only when you look for it.

Second: using a shadow to fix a bad colour choice. White text on a yellow background is unreadable, and no shadow fixes that — the answer is a darker text colour or a darker background. A shadow helps readable text stay readable over a photo; it cannot rescue text that was unreadable to begin with.

Third: forgetting that shadows do not print well. A shadow that looks good on screen can turn into a grey smudge on paper, and some printers drop shadows entirely. If the text must print, test the printout, or use a plain dark colour instead of a shadow.

Fourth: shadows on small text. Body text at 14 or 16 pixels does not need a shadow — the shadow blurs the edges of small letters and makes them harder to read. Keep shadows for headings and display text, and leave body text clean.

A second mistake is choosing a shadow colour that fights the text instead of supporting it. A black shadow under black text is invisible, and a white shadow under white text is invisible too — the shadow must contrast with the text colour, not match it. The usual pairing is a dark shadow under light text and a light shadow under dark text, with the shadow colour taken from the background rather than from the text. When the background is a photograph, pick the shadow colour from the darkest part of the photo behind the words.

How to use this text shadow generator

Type your preview text, then drag the three sliders: horizontal offset, vertical offset, and blur. Type a hex colour, such as #333333, into the colour box. The shadow value updates live — the default is "2px 2px 4px #333333" — and the CSS line in the box below is ready to copy.

Use the Copy button next to the output box to copy the CSS, then paste it into your stylesheet under the heading's rule. The blur is 4 pixels by default; raise it for a softer shadow, lower it to 0 for a hard edge.

Everything runs in your browser. No sign-up, no account, no data sent anywhere. It works offline once the page has loaded. Try the default on a real heading first, then adjust one slider at a time until the shadow looks right on your background.

Move the offset sliders first, then the blur, then pick the colour, watching the preview after each change. The preview uses a large sample sentence so a small change is easy to see, and the CSS value underneath updates with it. When the shadow looks right, copy the value and paste it into the stylesheet rule for the text. If the text sits on a photograph, test the same shadow on the real photograph before publishing — a shadow that looks right on a plain background can vanish on a busy image.

Frequently Asked Questions

Text-shadow puts a shadow behind the letters themselves, following the shape of each character. Box-shadow puts a shadow behind the rectangular box of an element, such as a card or a button. Use text-shadow for headings over photos and box-shadow for cards floating over a page.

In order: horizontal offset, vertical offset, blur radius, and colour. The default 2px 2px 4px #333333 moves the shadow 2 pixels right and 2 pixels down, blurs it over 4 pixels, and colours it dark grey #333333.

Yes. A negative horizontal offset moves the shadow left, and a negative vertical offset moves it up. An offset of -2px -2px with a light shadow on a dark background makes text look raised, and with a dark shadow it looks engraved.

No. Body text at 14 or 16 pixels does not need a shadow — the shadow blurs the edges of small letters and makes them harder to read. Keep shadows for headings and display text, and leave body text clean.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.