Slugify

Convert any text into a clean URL slug — strips accents and punctuation, collapses whitespace, and optionally truncates to a maximum length.

Loading tool…

Worked examples

  • A blog post title

    The everyday case: turning a human-readable title into a clean URL path segment, with punctuation stripped and spaces collapsed to hyphens.

  • Accented characters and an em dash

    Accents are stripped to their base ASCII letters (é becomes e) rather than dropped or percent-encoded, which is what most CMS and static-site slug fields expect.

  • Underscore separator, case preserved

    Some systems (Python module names, certain CMS slugs) prefer underscores over hyphens and want the original casing kept intact.

  • A long title truncated to a max length

    Truncation cuts at the character limit and then removes any dangling separator left at the end; here the cut happens to land just after a hyphen, so the slug ends on a whole word.

What this tool does

This tool converts any text — a blog post title, a product name, a document heading — into a clean URL slug: lowercase (by default), accents stripped, punctuation and whitespace collapsed into a single separator, with no leading or trailing separator left behind.

When you need it

  • Generating the URL path segment for a new blog post or page from its title, matching what most static site generators and CMS platforms expect.
  • Creating a filename-safe or ID-safe version of a title for use as a slug, anchor link or file name.
  • Normalizing user-submitted text — a category name, a tag, a username — into a consistent, URL-safe form before storing it.
  • Converting a title with accented characters or special punctuation into an ASCII-only slug that won't cause encoding issues in a URL.

How accented characters are handled

Characters like é, ñ, ü and ç are normalized to their closest plain ASCII letter — é becomes e, ñ becomes n — and the letters Unicode cannot decompose are transliterated by hand (ß becomes ss, ø becomes o, æ becomes ae, ł becomes l), rather than being deleted outright or left as percent-encoded UTF-8 bytes in the URL. This matches what most slug fields in CMS platforms and static site generators do, and keeps the resulting slug both readable and free of any character that would need URL-encoding.

Choosing a separator

Hyphens are the standard choice and are recommended for SEO: search engines generally treat a hyphen as a word boundary within a URL, so coffee-shops is understood as the two words "coffee" and "shops," while coffee_shops may be treated as a single token by some search engines. Underscores remain useful for contexts that specifically expect them — certain programming language identifiers or legacy CMS conventions — which is why both are offered.

What happens to repeated or leading/trailing punctuation

Runs of spaces, punctuation or any other non-alphanumeric characters collapse into a single separator instead of producing multiple consecutive hyphens. Any separator that would end up at the very start or end of the slug — for example from text that begins or ends with punctuation — is trimmed off, so titles like "-- Hello World! --" produce hello-world, not -hello-world-.

Truncating long titles

Setting a maximum length cuts the slug at exactly that character count and then removes any separator left dangling at the end. The cut is not word-aware: a word that straddles the limit is cut mid-word (hello-wonderful-world at a limit of 10 becomes hello-wond), while a limit that happens to land just after a hyphen yields a clean word boundary. Pick a limit with that in mind. This is useful when a platform enforces its own slug length limit, or simply to keep URLs from becoming unwieldy for very long titles.

Limits

Input is capped at 5,000 characters, and case is preserved only when lowercasing is explicitly turned off — most platforms expect lowercase slugs, which is why that's the default. Text in scripts with no Latin equivalent, such as Chinese, Japanese, Cyrillic or Arabic, is not transliterated: those characters are treated as punctuation and removed, so a title written entirely in them produces an empty slug.

Frequently asked questions

How are accented characters handled?
They're normalized to their closest ASCII equivalent — é, ñ and ü become e, n and u, and ß, ø, æ and ł become ss, o, ae and l — rather than being deleted or left as percent-encoded bytes. Scripts with no Latin equivalent (Chinese, Arabic, Cyrillic and so on) are not transliterated and are treated as punctuation, so a title written entirely in them produces an empty slug.
Can I use underscores instead of hyphens?
Yes — choose the separator, though hyphens are strongly preferred for SEO since most search engines treat a hyphen as a word boundary and an underscore as part of the word.
What happens to consecutive separators or punctuation?
Runs of non-alphanumeric characters collapse into a single separator, and leading or trailing separators are trimmed, so "Hello -- World!!" becomes hello-world, not hello---world.
Does truncation ever cut a word in half?
It can. When a maximum length is set, the slug is cut at exactly that many characters and any separator left dangling at the end is removed, but a word that straddles the limit is cut mid-word ("hello-wonderful" at limit 10 becomes "hello-wond"). Choose a limit that falls on a word boundary if that matters.