Slug Generator

Files & data

URL slugs that handle ñ the way a Filipino name needs.

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.

How to use

What it's for

Turn a title into a slug — the short, lower-case, hyphenated part of a web address — such as los-banos-travel-guide for a blog post.

Before you start

Have the title of the page or post. If the site limits how long an address can be, know that number too.

  1. Type the title

    Type or paste it in Title, replacing the example. Capitals become small letters, and spaces and punctuation become a single separator.

  2. Choose the separator

    In Separator, Hyphen is the usual choice for a web address. Pick Underscore only if the system you are using asks for it.

  3. Set a length limit, if you need one

    Type a number in Max length to keep the slug short; it is cut between words, never in the middle of one. 0 means no limit.

  4. Decide about ñ and accents

    Leave Convert ñ and accents to plain letters ticked so "Los Baños" becomes "los-banos", which copies and pastes cleanly. Untick it to keep the ñ, for example in a person's name.

  5. Generate and copy

    Press Generate to bring the slug into view; it also updates as you type. Then press Copy at the top to take it.

Reading the result

  • Slug: the finished slug, ready to copy.
  • Length: how many characters it has. Substitutions counts the letters swapped for plain ones, each listed under What changed, such as ñ → n.
  • A note says when the slug was cut to fit Max length, or when it starts with a digit.

If it goes wrong

  • The slug is empty: the title was all punctuation, or in a script this page does not convert. Add some ordinary letters or numbers.
  • The address shows %C3%B1 when pasted somewhere else: the slug still has an ñ or an accent in it. Tick Convert ñ and accents to plain letters.
  • A name lost its ñ: untick Convert ñ and accents to plain letters, knowing the address may then show %C3%B1 when copied.

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.

Keep going

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.