ToolsForWeb

Slugify

Convert a title or phrase into a lowercase, hyphen-separated, ASCII slug suitable for URLs and filenames.

Loading tool…

About this tool

Turn a title or phrase into a slug for a URL, filename or anchor. The text is Unicode-normalised and combining accents are stripped (é becomes e, ü becomes u), & is expanded to 'and', then every run of characters outside a–z, 0–9 becomes a single separator, with leading and trailing separators trimmed. Output is lowercased unless you turn that off, and an optional maximum length trims the slug back to a whole word where it can — but a single word longer than the limit is cut at that length. The separator can be a hyphen or an underscore.

When to use it

Generating the URL segment for a blog post, docs page or product from its title.
Producing a safe filename from a heading or document title.
Creating stable anchor ids for section links.
Normalising user-supplied names into keys for a slug column.

Questions

Why does a title in Cyrillic, Greek or Chinese come out empty?

Diacritic stripping only removes accents from Latin letters that Unicode can decompose. It does not romanize other scripts, so 'Привет' has no a–z characters left and the slug is empty. Add a Latin transliteration of the title yourself, or keep a separate manually chosen slug for those.

What happens to & and other symbols?

& becomes the word 'and' ('C++ & C#' → 'c-and-c'), which is the common convention for readable slugs. Every other symbol or space collapses to a single separator, so '+' and '#' simply disappear here.

How does the maximum length work?

The slug is cut to the limit and then trimmed back to the last separator, so 'one two three four' with a limit of 10 gives 'one-two', not 'one-two-th'. If there is no separator within the limit — a single word longer than the limit — the slug is cut at that length, so 'supercalifragilistic' with a limit of 5 gives 'super'.

Can I keep uppercase letters?

Yes — turn off the lowercase option and 'Hello World' becomes 'Hello-World'. Most URL routing is case-sensitive, so lowercase is the safer default.

Related tools