What is a URL slug? Best practices with examples
A URL slug is the last part of a web address that identifies one page in words, such as what-is-a-url-slug in texttoolset.com/blog/what-is-a-url-slug. A good slug is short, lowercase, describes the page and separates words with hyphens.
Published
A URL slug is the part of a web address that names a single page in plain words. In https://texttoolset.com/blog/what-is-a-url-slug, the slug is what-is-a-url-slug. Everything before it (the scheme, the domain and the /blog/ folder) is shared with other pages, while the slug is different for each one. Good slugs are short, lowercase, made of real words that describe the page, and use hyphens between words. To turn a title into one, paste it into the text to slug converter.
Where the slug sits in a URL
| Part | In this example | What it does |
|---|---|---|
| Scheme | https:// |
How the browser connects |
| Domain | texttoolset.com |
Which website |
| Path folder | /blog/ |
Which section of the site |
| Slug | what-is-a-url-slug |
Which page |
In WordPress, the %postname% permalink tag is described as “a sanitized version of the title of the post”, taken from the post slug field, so “This Is A Great Post!” becomes this-is-a-great-post. The WordPress default, “Plain”, uses addresses like example.com/?p=N, with a database ID instead of words, and the WordPress documentation calls this the “Ugly Permalink”.
What makes a good slug
Google’s URL structure guidelines give the main rules. The table sums them up with the reason behind each one.
| Rule | Good | Avoid | Why |
|---|---|---|---|
| Use readable words | /wiki/aviation |
/index.php?topic=42&area=3a5e |
Google recommends “readable words rather than long ID numbers” |
| Separate words with hyphens | remove-duplicate-lines |
remove_duplicate_lines, removeduplicatelines |
Google recommends hyphens instead of underscores |
| Keep it lowercase | /blog/title-case-rules |
/blog/Title-Case-Rules |
Paths are case-sensitive, so two capitalizations are two URLs |
| Plain letters and digits only | whats-new-in-2026 |
what's-new-in-2026? |
Punctuation such as ?, # and & has a special meaning in URLs |
| Keep it short and specific | creme-brulee-recipe |
the-best-and-easiest-creme-brulee-recipe-you-will-ever-make |
Easier to read, share and type |
| Use your readers’ language | /de/strasse for German readers |
an English slug on a German page | Google advises words in the audience’s language, transliterated if needed |
Two of these rules come from the URL standard itself. RFC 3986 lists the “unreserved” characters that can appear in a URL without any special meaning: uppercase and lowercase letters, digits, hyphen, period, underscore and tilde. Anything else either has a job (? starts the query, # starts a fragment, / separates folders) or must be percent-encoded. The same standard says the scheme and the host are case-insensitive but that other parts, including the path, “are assumed to be case-sensitive”. Google follows this: its guidelines say /APPLE and /apple are treated as distinct URLs. If your site lets both work, you may end up with two addresses for one page.
How a title becomes a slug
Most slug generators follow the same steps. This is exactly what our text to slug tool does with each line you paste:
- Spell out compatibility characters: the ligature fi becomes fi, a superscript ² becomes 2 and ½ becomes 1 and 2 (
½ cupgives1-2-cup). - Replace
&with the word “and”. - Delete apostrophes, both straight (’) and curly (’), so “what’s” becomes “whats” rather than “what-s”.
- Remove accents: é becomes e, ü becomes u, and letters that do not decompose are mapped too (ß to ss, æ to ae, ø to o, ł to l).
- Lowercase everything (the Lowercase option, on by default).
- Treat every run of characters that is not a plain letter A–Z or a digit as a single break, and join the words with the Separator (hyphen by default, or underscore).
Here are real outputs from the tool with its default settings:
| Title | Slug |
|---|---|
| 10 Tips for Writing Better Titles | 10-tips-for-writing-better-titles |
| Crème Brûlée: The Chef’s Recipe! | creme-brulee-the-chefs-recipe |
| What’s New in 2026? | whats-new-in-2026 |
| Salt & Pepper Shrimp | salt-and-pepper-shrimp |
| Straße in Łódź | strasse-in-lodz |
| 50% Off — Today Only | 50-off-today-only |
| C++ vs C#: Which to Learn? | c-vs-c-which-to-learn |
The last row shows why you should always read the result. Symbols carry meaning in “C++” and “C#”, and the slug loses it, so a hand-written cpp-vs-csharp is clearer. Slug tools also keep only Latin letters and digits: a title written entirely in another script, such as Привет мир, gives an empty slug (the tool then names the line that came out empty), and 東京 travel guide gives just travel-guide. For those pages, write a transliterated slug yourself or keep the original letters (see the accents section below).
Short words and length
Long titles make long slugs. There are two simple ways to trim them, and the tool has an option for each.
Drop short words. Words like “a”, “the”, “of” and “in” rarely add meaning to a slug. With Drop short words (a, the, of…) turned on, the tool removes a, an, the, and, or, of, to, in, on, for, with, at, by and from, but only when the slug has more than two words, so short titles stay intact:
| Title | Default | Drop short words |
|---|---|---|
| A Guide to the Best Coffee Shops in Paris | a-guide-to-the-best-coffee-shops-in-paris |
guide-best-coffee-shops-paris |
| Of Mice and Men | of-mice-and-men |
mice-men |
| The Office | the-office |
the-office |
“Of Mice and Men” shows the downside: mice-men is no longer the book title. Drop short words when they are filler, and keep them when they are part of a name.
Set a maximum length. With Max length set to a number, the tool cuts the slug to that many characters and then goes back to the last separator, so a word is not chopped in half. With a limit of 30, how-to-remove-duplicate-lines-in-excel becomes how-to-remove-duplicate-lines. If there is no separator in the second half of the limit, the cut is made exactly at the limit, which can split a long word, so check those results by hand.
There is no official character limit for slugs. Aim for the few words that name the topic, and remember that the full URL, not just the slug, is what people see and share.
Accents and non-English slugs
You have two choices for letters outside A–Z. You can transliterate them into plain ASCII (creme-brulee, sao-paulo), which our remove accents tool does on any text, including the ß, æ, ø and ł conversions. Or you can keep them. Google’s guidelines allow non-ASCII words but say they should be percent-encoded in the URL. In encoded form, the accented slug looks like this:
crème-brûlée → cr%C3%A8me-br%C3%BBl%C3%A9e
For an English-language site, plain ASCII slugs are the simpler choice. For a site written in Russian, Arabic or Japanese, Google’s guidance to use words in the audience’s language points the other way. The guide to URL encoding explains how percent-encoding works, and the URL encoder shows the encoded form of any text.
Changing a slug after publishing
A slug is part of the page’s address, so changing it changes the URL. Links from other sites, bookmarks, shared posts and search results still point to the old one. WordPress calls its URLs permalinks because they “should never be changed”.
If you must change a slug (for a typo, or a page that now covers a different topic), set up a redirect from the old address to the new one. Google’s documentation on redirects recommends “a permanent server-side redirect whenever possible”, which means an HTTP 301 or 308 status code. Old links keep being used long after the change, so do not plan to remove the redirect soon. This site follows that rule: the old addresses of the previous version of texttoolset.com still work.
Slugs and other naming styles
A slug is a close relative of kebab-case, the lowercase-with-hyphens style used for CSS classes and file names. The difference is that a slug generator also strips accents, apostrophes and symbols so the result is safe in a URL. If you need the same words as camelCase or snake_case for code, see camelCase vs snake_case vs kebab-case or use the kebab-case converter.
Questions
Is the slug the same as the URL?
No. The URL is the whole address, including the scheme (https), the domain and the path. The slug is only the final, human-readable part of the path that names the page.
Should a slug use hyphens or underscores?
Hyphens. Google's URL structure guidelines recommend hyphens instead of underscores to separate words, because hyphens help users and search engines identify the separate words. The text to slug converter uses hyphens by default.
Are URL slugs case-sensitive?
Yes, the path is case-sensitive by default under RFC 3986, and Google treats /APPLE and /apple as two different URLs. Keeping every slug lowercase avoids duplicate addresses and broken links from mistyped capitals.
Should I remove "a", "the" and "of" from slugs?
It is optional. Dropping them makes a long slug shorter, but keep them when the slug would lose its meaning without them. Our tool's "Drop short words" option removes them only when the slug has more than two words.
Can I change a slug after publishing?
You can, but the old address then stops working unless you add a permanent (301 or 308) redirect from the old URL to the new one, which is what Google recommends when a URL changes.
Sources
- Google Search Central, URL structure best practices for Google Search, https://developers.google.com/search/docs/crawling-indexing/url-structure (checked 2026-10-21)
- Google Search Central, Redirects and Google Search, https://developers.google.com/search/docs/crawling-indexing/301-redirects (checked 2026-10-21)
- IETF, RFC 3986: Uniform Resource Identifier (URI): Generic Syntax, sections 2.3 and 6.2.2.1, https://www.rfc-editor.org/rfc/rfc3986 (checked 2026-10-21)
- WordPress.org Documentation, Customize permalinks, https://wordpress.org/documentation/article/customize-permalinks/ (checked 2026-10-21)