CSS Text Spacing Generator
Generate CSS letter-spacing, word-spacing, line-height, text-indent and tab-size with a live paragraph preview. Choose px, em or rem units and copy the CSS and HTML.
Input
Only used for the preview and HTML snippet.
In the chosen unit (em is relative to the font size).
Width of a tab character; visible in pre-formatted text.
Output
Your spaced text will appear here.
More ways to use this tool
REST API
curl -X POST https://api.iotools.cloud/v1/tool/css-text-spacing-generator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'Swap in your own key from your account. The tool's fields are the body — no wrapper.
Ask an AI agent
Use the IOTools `css-text-spacing-generator` tool (CSS Text Spacing Generator) on this input:
YOUR_INPUT_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.
Embed widget
<iframe
src="https://iotools.cloud/embed/css-text-spacing-generator/"
width="100%" height="520" frameborder="0" scrolling="no" loading="lazy"
title="CSS Text Spacing Generator — iotools.cloud"
sandbox="allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox"
allow="clipboard-write"
style="width:100%;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden"></iframe>
<script src="https://iotools.cloud/embed.js" async></script>Drop this into your own page — free, no key required, just a link back.
| Cost per API/MCP call | From 5 credits |
|---|---|
| Need more credits? | View pricing |
Also available with
Guides
Spacing is what makes text readable. CSS gives you five properties to control it: letter-spacing, word-spacing, line-height, text-indent and tab-size. This generator lets you adjust all of them against a live paragraph and copy the CSS.
How to use it
- Paste or type sample text. It only drives the preview and the HTML snippet.
- Adjust letter and word spacing. Small positive values open up headings and uppercase text; small negative values tighten large display type.
- Set the line height. A unitless value such as
1.5scales with the font size. Body text usually reads best between 1.4 and 1.7. - Add a first-line indent if you want the book-style paragraph look.
- Choose a unit.
emandremscale with font size;pxis fixed. - Copy the output: the declarations, a full CSS rule and a matching HTML snippet.
Quick reference
letter-spacingis often called tracking. Around0.05emto0.1emsuits all-caps labels.word-spacingchanges the gap between words only.line-heightis leading. Use a unitless number so nested elements inherit the ratio, not a computed length.text-indentindents only the first line of a block.tab-sizesets how wide a tab character renders inwhite-space: preblocks.
Accessibility tips
WCAG 1.4.12 asks that text still works when users set line height to at least 1.5, paragraph spacing to 2× and letter spacing to 0.12em. Avoid fixed-height containers that clip text when spacing grows.
For lines under or through text, see the CSS Text Decoration Generator. For shadows, try the CSS Text Shadow Generator.
Privacy
Everything runs in your browser. Your text and settings are never uploaded.