Slug Generator
Understand Slug Generator
Converts a title into a lowercase, hyphen-separated URL slug.
How it works
Latin-1 accented characters are mapped to their ASCII bases from an explicit table (é to e, ø to o, ñ to n, ß to ss, æ to ae), the text is lowercased unless you turn that off, every character outside A-Z, a-z, 0-9, whitespace, underscore, and hyphen is deleted, and runs of whitespace, underscores, and hyphens collapse into the single separator you picked. The result needs no percent-encoding in a URL path.
When to use it
- Deriving a blog post or documentation URL from its title.
- Producing a stable product or category path for a storefront.
- Turning a free-text ticket title into a branch name or a file name.
- Normalizing an imported dataset into keys that are safe in a URL.
- Switching the separator to an underscore for a system that requires one.
Watch out for
- Non-Latin scripts are removed, not transliterated. Chinese, Cyrillic, Greek, and Devanagari characters have no entry in the mapping table, so they are stripped and the slug can come back empty. Transliterate those titles yourself or set the slug by hand.
- Use hyphens rather than underscores. Google treats a hyphen as a word separator and an underscore as a word joiner, so json_formatter is indexed as the single token jsonformatter.
- Slugs are not unique. Two posts called "Getting Started" produce the same slug — add a discriminator or check for a collision before saving.
- Changing a published slug breaks every link that already points at the old one. Keep the previous path and 301 it to the new one instead of editing in place.
Frequently Asked Questions
What is a URL slug?
A URL slug is the human-readable identifier at the end of a URL. In /blog/how-to-convert-json-to-yaml, the slug is "how-to-convert-json-to-yaml". Good slugs are lowercase, hyphen-separated, and free of special characters.
Should I use hyphens or underscores in URL slugs?
Always use hyphens. Google treats hyphens as word separators (enabling keyword matching), but underscores as word joiners (so "json_formatter" is indexed as one word "jsonformatter"). This is confirmed in Google's URL structure guidelines.
How are accented characters handled?
Accented characters are transliterated to their ASCII base: é→e, ü→u, ñ→n, ç→c. This ensures slugs work in any browser, server, and file system without percent-encoding, and remain SEO-friendly across languages.
How to Use Slug Generator
- Paste or type your input in the input area above.
- The tool processes your input automatically or click Run.
- Copy or download the result using the action buttons.
- Use Ctrl+Enter to run quickly from the keyboard.