Slugify

Convert any title or phrase into a clean URL-safe slug.

Related Tools

0 comments

How it works

The input is Unicode-normalised to NFD form, which separates accented letters into a base letter plus a combining mark. The combining marks are stripped, leaving plain ASCII (é → e, ñ → n). The text is then lowercased, non-alphanumeric runs are collapsed to a single hyphen, and leading/trailing hyphens are trimmed. The result is the safest possible slug for routing and SEO across every CMS, framework and static-site generator.

Common use cases

  • Generating a URL slug for a blog post title before pasting into your CMS.
  • Producing safe filenames from user-supplied document titles.
  • Deriving stable identifiers from category or tag names.

Frequently asked questions

How are accents handled?

Unicode NFD normalisation strips combining marks, so "Café" becomes "cafe" and "Łódź" becomes "odz" (note: ł has no combining decomposition and is dropped). For mixed-language sites you may want a transliteration library instead.

Will it produce duplicate slugs?

Two distinct titles can map to the same slug (e.g., "Top 10!" and "top-10"). Always uniquify against existing slugs in your database.

Why lowercase only?

Mixed-case URLs cause case-sensitivity bugs across servers and caches. Lower-only is universally safe.

Are query-string-unsafe characters handled?

Yes — any non-alphanumeric run is collapsed to a single hyphen, so the result needs no further URL-encoding.