Slug Generator
Convert a title or phrase into a clean, lowercase, hyphenated URL slug, live as you type. Accents are transliterated and special characters removed.
What is a URL slug?
A slug is the readable part of a URL that names one page, such as my-first-post in /blog/my-first-post/. A good slug uses only lowercase ASCII letters, digits and hyphens, so it never needs percent-encoding, reads well when the link is shared, and tells people and search engines what the page is about before they open it. This tool turns a title into that form as you type.
How to use the slug generator
- Type or paste a title into the Text field. The slug updates on every keystroke.
- Choose a Separator: Hyphen (-) or Underscore (_).
- Leave Lowercase ticked for URLs; untick it to keep the original capitals.
- Click Copy. A dash in the result box means nothing usable was left.
Exactly what the tool does to your text
- Splits accented letters into a base letter plus accent (Unicode NFD) and drops the accent, so
é,çandşbecomee,cands. - Replaces Latin letters that have no accent to drop:
ß→ss,æ→ae,œ→oe,ø→o,ł→l,đandð→d,þ→thand the Turkish dotlessı→i. - Removes apostrophes, straight or curly, so
don'tbecomesdontrather thandon-t. - Lowercases the text if Lowercase is ticked.
- Replaces every run of characters other than
A–Z,a–zand0–9with one separator, and trims separators from both ends.
The tool does not remove stop words, shorten long titles or check whether a slug is already in use. Those are editorial decisions, covered below.
Examples
| Text | Slug |
|---|---|
My Awesome Blog Post! | my-awesome-blog-post |
10 Tips & Tricks for CSS! | 10-tips-tricks-for-css |
Straße in Kraków | strasse-in-krakow |
Kılıç ve Şiş | kilic-ve-sis |
Don't Panic: The Søren Æsir Guide | dont-panic-the-soren-aesir-guide |
Version 2.0 Release | version-2-0-release |
My Awesome Blog Post! with Underscore and Lowercase off | My_Awesome_Blog_Post |
The same steps in JavaScript
If you need slugs inside an application, this function follows steps 1, 3, 4 and 5 above with hyphens. Add a lookup table for step 2 if your titles include letters such as ß or ø.
function slugify(text) {
return text.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
.replace(/['\u2019]/g, '')
.toLowerCase()
.replace(/[^a-z0-9]+/g, '-')
.replace(/^-+|-+$/g, '');
}
slugify('Crème Brûlée: Don’t Panic!'); // 'creme-brulee-dont-panic'
Generate the slug once, when the page is created, and store it. Working it out again from the title on every request means that fixing a typo in a title silently changes the URL.
Hyphen or underscore?
Use hyphens in URLs. Google’s URL structure guidelines recommend hyphens rather than underscores to separate words, and hyphens stay visible when a link is underlined. Underscores are useful elsewhere: file names, database table and column names, and Python module names, which cannot contain a hyphen.
Common problems and fixes
| Problem | Cause | Fix |
|---|---|---|
| The result is a dash | The title is in a non-Latin script such as Cyrillic, Greek, Arabic or Chinese, which the tool drops. | Transliterate the title yourself, or keep it in its own script (see the FAQ). |
| Two titles give the same slug | Symbols are removed: C++ vs C# becomes c-vs-c. | Spell symbols out (cpp-vs-csharp) or add a distinguishing word. |
| Symbols and emoji disappear | Only letters and digits are kept; ½, & and emoji become separators. | Write the word if it matters, such as and or half. |
| The slug is very long | Every word of the title is kept. | Edit the text down to the key words before copying. |
Frequently asked questions
Should I remove words like “the” and “and”?
Only if the slug still reads naturally. how-to-bake-bread is clearer than how-bake-bread. Removing small words mainly helps when a long title would otherwise give an unwieldy URL.
What happens if I change a slug after publishing?
The old URL stops working and links to it break. If you must change it, set up a permanent (301) redirect from the old URL to the new one, so visitors and search engines are sent to the right page.
Why lowercase?
The path of a URL is case-sensitive under RFC 3986, so /About and /about can be different pages on many servers. Using lowercase everywhere avoids duplicates and links that fail because of one capital letter.
Can a slug use non-Latin characters?
Yes. Browsers display a path like /привет as written, though it travels percent-encoded as %D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82 and looks like that when copied into some apps. For a site written in that language this is often the better choice; this tool is meant for Latin-script slugs.
Should I put dates or IDs in the slug?
Add a date only when it is part of what the page is, such as a news item or release notes; evergreen pages read better without one. Many systems also add a numeric ID, which keeps URLs unique even when two titles produce the same slug.
Is the text I type stored?
No. The slug is worked out in your browser on every keystroke and nothing is sent to a server or saved.