What a slug is
A slug is the part of a web address that identifies one page in words. In example.com/blog/creme-brulee-recipe, the slug is creme-brulee-recipe. Content systems such as WordPress, Shopify and most static site generators build slugs from page titles. Shopify calls them handles.
A good slug is easy to read, easy to type and safe in any browser. That means lowercase letters, digits and a single separator between words. No spaces, no punctuation, no accents that turn into long %C3%A9 codes when the link is copied.
This tool does that conversion for a whole list at once, one slug per line.
How to use the slug generator
- Paste your titles into Titles, one per line. Each line becomes one slug, and blank lines stay blank so the output lines up with your list.
- Read the results in Slugs and press Copy.
- Change the options at the bottom to suit your site:
- Separator: hyphen, underscore, dot or none.
- Max length (0 for no limit): the longest slug you want. Long slugs are cut at the last whole word that fits.
- Lowercase: on by default. Turn it off to keep capitals.
- Convert accents (é to e): replaces accented and special Latin letters with plain ones.
- Remove stop words: drops short filler words such as the, a, to, and, of and for.
The line under the tool shows how many slugs you made and the length of the longest one.
Examples
These slugs come from running the generator on each title.
| Title | Option | Slug |
|---|---|---|
| 10 Tips & Tricks for Café Owners | default | 10-tips-and-tricks-for-cafe-owners |
| 10 Tips & Tricks for Café Owners | Remove stop words | 10-tips-tricks-cafe-owners |
| Why Your Sourdough Isn’t Rising (and How to Fix It) | default | why-your-sourdough-isnt-rising-and-how-to-fix-it |
| Why Your Sourdough Isn’t Rising (and How to Fix It) | Max length 20 | why-your-sourdough |
| Straße, Łódź und Ørsted: A Guide | default | strasse-lodz-und-orsted-a-guide |
| Straße, Łódź und Ørsted: A Guide | accents kept | straße-łódź-und-ørsted-a-guide |
| The Best Way to Learn a Language | Remove stop words | best-way-learn-language |
| Crème Brûlée Recipe | underscore | creme_brulee_recipe |
| Hello World | Lowercase off | Hello-World |
| Hello World | no separator | helloworld |
How it works
Each line goes through the same steps:
- An ampersand becomes the word “and”, and apostrophes are removed, so “Isn’t” becomes “isnt” rather than “isn-t”.
- If accent conversion is on, letters such as ß, æ, ø and ł are spelled out, then Unicode normalization splits letters like é into e plus an accent mark, and the mark is dropped.
- The text is lowercased if that option is on.
- Every run of letters and digits becomes a word. Everything else, including punctuation and extra spaces, is a break between words.
- Stop words are removed if you asked for it. If a title is made only of stop words, they are kept so the slug is not empty.
- The words are joined with your separator and trimmed to the maximum length at a word boundary.
Everything happens in your browser.
Tips for good slugs
- Keep them short. Three to six meaningful words is usually enough. Use Max length or Remove stop words to trim long titles.
- Do not include dates unless the date is the point of the page. A slug without a year can be updated later without a redirect.
- Pick one style and keep it. Mixing hyphens and underscores across a site looks messy and makes links harder to guess.
- Change slugs with care. Once a page is live and linked, a new slug breaks old links unless you set up a redirect from the old address.
- Check for duplicates. Two posts with the same title will get the same slug. Most systems add
-2to the end, but it is better to make the titles different.
Other ways to make a slug
In JavaScript, a quick version for plain English text is:
'Hello World'.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '')
That returns hello-world. It does not handle accents, so Café would lose its last letter. Python has the python-slugify package, and most frameworks include a slug helper, such as Str::slug in Laravel and slugify in Django.
In a spreadsheet you can chain LOWER and SUBSTITUTE, but accents and punctuation need one SUBSTITUTE each, so pasting the list here is quicker.
Related tools
For variable names rather than web addresses, use the kebab case converter. To encode text that must stay exactly as typed inside a link, use the URL encoder. To add campaign tracking to the finished link, use the UTM generator.