Slug Generator

[ SLUG ]
ang-pinakamagandang-tanawin-sa-los-banos-laguna
47 characters
Length47
Substitutions1
[ WHAT CHANGED ]
ñn
ñ was written as n. That is what you want in a URL, but ñ is a letter in its own right rather than an n with a mark — so if this is a personal name, check that the substitution is acceptable. Turn transliteration off to keep it.
[ WHAT THIS IS ]

The part generic slugifiers get wrong is ñ. The usual implementation normalises to NFD, strips combining marks, and keeps what is left — which turns ñ into n by accident, because ñ decomposes to an n plus a tilde.

That is right for é → e. ñ is different: it is a letter in its own right, not an n with a decoration.

Los Baños becoming los-banos is what you actually want in a URL. But the tool should say it made that substitution rather than performing it invisibly — because you may be slugging a personal name.

So transliteration is an option, not a silent default, and every substitution is listed.

[ QUESTIONS ]

What happens to ñ?

It becomes n, and the page tells you it did. That is what you want in a URL — Los Baños becomes los-banos — but ñ is a letter in its own right rather than an n with a mark on it, unlike é or ü. A generic slug function that strips combining marks turns ñ into n by accident and never mentions it, which is fine for a blog title and worth knowing about for a personal name. You can turn the substitution off.

Should I keep ñ in the URL instead?

You can, and browsers handle it correctly by percent-encoding the character. The cost is that the URL reads as los-ba%C3%B1os when it is copied out of the address bar and pasted into a message or an email. Most sites transliterate for that reason, not because the alternative is broken.

Why does my slug not end in a hyphen?

Because separators are collapsed before the ends are trimmed, in that order. Doing it the other way round leaves a trailing hyphen whenever the text ends in punctuation — “Hello, world!” becomes hello-world- — which is the classic off-by-one of this function.

How does the length limit work?

It cuts at a separator, never in the middle of a word. A slug ending in half a word reads as broken and the fragment carries no meaning anyway, so the last partial word is dropped rather than truncated.

Why is my slug empty?

Because nothing was left after removing everything that cannot appear in a slug — text made entirely of punctuation, or of a script this does not transliterate. An empty slug is the honest answer; inventing one would give you a URL that means nothing.

Are slugs good for SEO?

A readable slug helps a person decide whether to click a result, which matters more than any direct ranking effect. Keep it short, keep the meaningful words, and do not stuff it with keywords. Above all, do not change a slug that is already published without redirecting the old one — see the HTTP status codes page for which redirect to use.

[ THE MATHS ]
The order, and why it matters
1. Stripeverything a slug cannot hold
2. Collapseruns of separators into one
3. Trim the endsleading and trailing separators

Swap 2 and 3 and you leave a trailing hyphen whenever the text ends in punctuation: "Hello, world!" becomes hello-world-. It is the classic off-by-one of this function.

[ THE LENGTH LIMIT ]

It cuts at a separator, never mid-word. A slug ending in half a word reads as broken, and the fragment carries no meaning anyway.

[ NEXT ]
49Text Case Converterkebab-case, without the URL rules
51Word & Character CounterHow long the headline actually is
72HTTP Status CodesWhich redirect when a slug changes
55Text RedactorAlso runs entirely in your browser
[ IMPORTANT ]

Runs entirely in your browser. Transliteration is a choice rather than a default you cannot see — every substitution is listed, because ñ becoming n matters more in a personal name than in a headline. Nothing you type here is sent to our servers — the calculation runs entirely in your browser.