Tools
Guides

Slugify

Text

Convert any text — including Chinese, accents and emoji — into a clean URL-safe slug. Pick a separator, case, CJK-to-pinyin transliteration and an optional length cap, with live preview.

100% client-side No backend
Input
Output
Type or paste text to generate a slug.
On this page

What is a slugify tool?#

A slugify tool turns a human-readable title into a URL-safe slug — the compact, lowercase, punctuation-free string that lives in a web address after the domain. How to Brew Coffee at Home becomes how-to-brew-coffee-at-home; Café Münchën becomes cafe-munchen; 你好世界 becomes ni-hao-shi-jie. Slugs are how blogs, e-commerce sites and documentation systems build readable, shareable, SEO-friendly URLs from titles that were never written with a URL in mind.

The tricky parts are exactly the characters people actually use: accents (café), ligatures (ß, æ), em-dashes and smart quotes, and CJK ideographs that have no ASCII representation at all. A naive “delete everything that isn’t a-z” turns 你好世界 into an empty string, which produces a broken URL. This tool handles all three properly: it decomposes accented letters and strips the combining marks (é → e), maps the non-decomposing Latin ligatures (ß → ss, æ → ae), and transliterates CJK ideographs to toneless pinyin (你好世界 → ni hao shi jie) so a Chinese title still produces a meaningful, pronounceable slug.

Everything runs locally. The pinyin dictionary is loaded only when the input actually contains CJK, so a pure-Latin slug never pays for it.

How to use it#

  1. Type or paste the title into the input pane on the left.
  2. Choose the separator — dash (default) or underscore.
  3. Tick Lowercase (on by default) to fold the output to lowercase; untick if you need to preserve case.
  4. Tick Transliterate (on by default) to convert CJK characters to toneless pinyin; untick if you want CJK stripped rather than transliterated.
  5. Optionally set a Max length (0 means unlimited). When the slug exceeds it, it is cut and any dangling trailing separator is trimmed so the URL never ends on a bare -.
  6. Read the output pane on the right — the slug appears the moment input or any option changes. Hit Copy to grab it.

The status line reports the slug length and flags two special cases: when CJK was transliterated, and when the result was truncated to fit a max length.

Key features#

  • Accent and ligature handling. NFKD decomposition plus a small Latin compatibility map turns café, Münchën, straße, œuvre into clean ASCII (cafe, munchen, strasse, oeuvre) instead of dropping the letters entirely.
  • CJK to pinyin. Chinese ideographs are transliterated to toneless pinyin using a bundled dictionary, so 你好世界 becomes ni-hao-shi-jie — a pronounceable, meaningful slug rather than an empty or mangled one.
  • Clean word boundaries. CJK runs are wrapped in spaces before the separator pass, so transliterated output separates into words (ni-hao) rather than gluing together (nihao).
  • Length cap with clean trim. A max length cuts the slug and then strips any dangling trailing separator, so you never get a URL ending in -.
  • Dash or underscore. Pick the separator your platform expects — most modern web slugs use dashes, but some systems and file-name conventions use underscores.
  • Lazy pinyin load. The pinyin dictionary is imported only the first time the input actually contains CJK, so an all-Latin slug never downloads it.
  • Local and never throws. Empty input reports empty; input that strips down to nothing (for example, only emoji) reports no-output. Failures become a clear message, never an exception.

Worked example#

Paste the title from the input placeholder, with all defaults (dash separator, lowercase on, transliterate on):

Café Münchën — 你好世界

Step by step:

  1. CJK is detected, so 你好世界 is transliterated to ni hao shi jie.
  2. Accents are stripped: Café → Cafe, Münchën → Munchen.
  3. The em-dash and spaces collapse to the separator.
  4. The result is lowercased and leading/trailing separators are trimmed.

The output pane shows:

cafe-munchen-ni-hao-shi-jie

Now set Max length to 20 and regenerate. The slug is cut and the dangling trailing dash is removed:

cafe-munchen-ni-hao

Notice the accents became plain ASCII, the Chinese title became pronounceable pinyin separated into words, and the length cap produced a clean URL fragment rather than one ending mid-word or on a bare dash.

FAQ#

Why does my Chinese title become pinyin instead of staying as characters?#

Because URLs are safest and most portable when they use ASCII. CJK characters in a URL require percent-encoding (each 你 becomes %E4%BD%A0), which is unreadable to humans and to many analytics tools. Toneless pinyin keeps the slug pronounceable, meaningful and ASCII-only — ni-hao-shi-jie is a far better URL than a string of percent signs. If you would rather keep the original characters, untick Transliterate.

What happens to emoji and other non-alphanumeric symbols?#

They are stripped. Emoji, smart quotes, brackets and most punctuation do not survive the slug pipeline — they are not letters, so the non-alphanumeric collapse pass turns them into separators. If your input is only emoji and symbols, everything strips away and the tool reports no-output rather than emitting an empty slug.

Should I use a dash or an underscore as the separator?#

For URLs that humans will read, use a dash — search engines treat dashes as word separators and dashes are the convention across virtually all modern web platforms. Underscores are appropriate when the slug is really a filename or an identifier consumed by a system that reserves dashes for something else (version ranges, flags). The tool supports both so you can match whatever your target expects.

How does the max length cut work?#

The slug is built in full first, then cut to the requested length. If the cut lands in the middle of a word, the word is left partial; if the cut leaves a trailing separator, that separator is trimmed. This guarantees the slug never exceeds the limit and never ends on a bare - or _, which is what URL fields and database column widths actually require.

Is this the same as URL-encoding?#

No, and the difference matters. URL-encoding (percent-encoding) escapes characters so they can travel inside a URL — café becomes caf%C3%A9. Slugifying instead normalises the text into ASCII letters and separators — café becomes cafe. Slugs are for the human-readable path segment of a URL; percent-encoding is for safely transporting arbitrary values in query strings. If you need the latter, use the /en/encoding/url/ tool.