URL Slug Generator
Convert a title into a URL-safe slug. Accents and language-specific letters are folded rather than dropped.
—
What this tool does
A slug is the human-readable part of a URL that identifies a page: the
url-slug-generator in /url-slug-generator/. Getting it right matters
more than it looks. A slug with accents, spaces or punctuation has to be percent-encoded in the
address bar, which makes it ugly and can break when the link is pasted into chat apps, email
clients or older systems. A slug that keeps its accents in one place and loses them in another
produces two URLs for the same page, which splits search signals.
Method
The phrase is decomposed with Unicode NFD so that accented letters separate into a base letter plus a combining mark; the marks are then removed, which folds é to e and ệ to e without a lookup table. A small additional map handles the letters that do not decompose and have a conventional Latin equivalent — đ→d, ß→ss, ø→o, æ→ae, œ→oe, ł→l, þ→th, ı→i. The result is lower-cased, apostrophes are dropped so don’t becomes dont, every remaining run of non-alphanumeric characters becomes a single hyphen, and leading and trailing hyphens are trimmed.
Example
| Input | Slug |
|---|---|
| 10 mẹo hay cho Đà Nẵng — 2026 | 10-meo-hay-cho-da-nang-2026 |
| Café & Crème Brûlée | cafe-creme-brulee |
| Don’t Panic! (A Guide) | dont-panic-a-guide |
| Straße Übersicht | strasse-ubersicht |
What a slug has to survive
A slug is the human-readable part of a URL. It is not just “the title with spaces replaced” — it has to survive being copied out of a browser, pasted into a chat application, put in an email, and read aloud. That imposes a stricter character set than a filename:
- Lowercase ASCII letters, digits and hyphens. Nothing else is safe without escaping, and escaped characters in a path are unreadable.
- Hyphens, not underscores. Google treats hyphens as word separators; underscores join words into one token.
- No leading or trailing hyphen, no doubled hyphens. They look like a mistake and some routers normalise them inconsistently.
- No percent-encoding. A slug containing
%20is a slug that was not finished.
Accents: transliterate, do not strip
There are two ways to remove an accent, and only one of them is right. Stripping the
diacritic turns café into caf, which loses a letter. Transliterating
turns it into cafe, which is the ASCII spelling a reader expects. This tool decomposes
with NFD, removes the combining marks, and keeps the base letter — so Café becomes
cafe, not caf.
German ß is the special case: it has no decomposed form, so it has to be mapped explicitly
to ss, which is what German orthography does when the character is unavailable.
Straße → strasse, not strae.
Vietnamese is the hardest Latin-script case because one letter can carry two diacritics —
Đà Nẵng has a base change (Đ) and tone marks on two vowels. The base change has to be
mapped (Đ → d) and the tone marks removed, giving da-nang.
The same logic is available as a dedicated tool if you need it without the slug formatting.
The characters people expect to survive
| Character | Slug result | Reason |
|---|---|---|
| apostrophe (’ or ') | removed | Don't → dont, the common convention |
| ampersand | removed or “and” | This tool removes it: Café & Crème → cafe-creme |
| plus | hyphen | It means a space in a query string, so it becomes a word break: a+b → a-b |
| percentage | removed | It starts a percent-escape |
| slash | hyphen | A literal slash would create a new path segment: a/b → a-b |
| digits | kept | Years and ids are meaningful and safe |
Length and uniqueness
Slugs are not required to be unique by any standard, but two different titles can produce the same
slug — Café & Crème and Cafe Creme both become
cafe-creme. If the slug is a key, you need a collision strategy: append a short id or a
counter, and check before publishing. If the slug is only cosmetic (the id is the key), a collision
is harmless.
Long titles produce long slugs. There is no hard limit, but practical limits exist: some systems cap path segments, and a slug beyond about 60–75 characters is unlikely to be read in full. Truncating at a word boundary and dropping a trailing hyphen — the failure mode of a naive cut — is safer than truncating mid-word.
Non-Latin scripts
A title written entirely in Chinese, Japanese, Cyrillic or Arabic has no Latin base letters to keep, so transliteration-by-decomposition produces an empty string. This tool reports an empty result rather than inventing a transliteration, because choosing one (pinyin? Hepburn? ISO 9?) is a language decision, not a formatting one.
For those titles the practical options are: keep the original characters in the URL (modern browsers display them, and the server percent-encodes them), or supply a manual Latin slug. Note that an empty slug concatenated into a path produces a double slash — worth checking for before you publish.
Slug versus title, in search
The slug is a ranking signal, but a weak one. Words in the slug are treated like words in the URL,
and they help a reader decide whether to click. That argues for a readable slug over a keyword-stuffed
one: how-to-convert-base64-to-text reads better and ranks no worse than
base64-converter-online-free-tool.
Frequently asked questions
Should a slug keep words like “the” and “of”?
Usually not, but consistency matters more than the choice. A slug is for humans and for matching, not for grammar; dropping stop words makes it shorter, while keeping them makes it predictable from the title. Pick one rule, apply it to every page, and do not change a published slug without a redirect.
What makes a good slug?
Lower case, words separated by single hyphens, no punctuation, and only ASCII letters and digits. That form survives every URL parser, is readable in a link, and avoids percent-encoding.
What happens to accents and non-Latin letters?
Accented Latin letters are folded to their base form: café becomes cafe, Đà Nẵng becomes da-nang, and characters such as ß, ø and æ become ss, o and ae. Scripts with no Latin equivalent — Chinese, Japanese, Arabic, Cyrillic — are removed, so you may want to supply a transliteration yourself.
Why are underscores and dots a bad idea?
Google treats hyphens as word separators but underscores as part of a word, so hyphenated slugs read better in search. Dots are reserved for the host and file extension, and can confuse caches and routers.
Does the trailing hyphen get removed?
Yes. Leading and trailing hyphens are stripped, and runs of hyphens are collapsed to one.
What about the Vietnamese letter đ?
It is mapped to d explicitly, because it is not an accented form of d and does not decompose — the same rule used by our Vietnamese accent tool.
Go deeper
Longer explanations of the problems this tool solves:
Sources
- Unicode Standard, normalization form NFD and the combining diacritical marks U+0300–U+036F.
- RFC 3986, Uniform Resource Identifier (URI): Generic Syntax, for the characters that are safe in a URL path.
Everything runs in your browser — nothing you type is uploaded.