piapia123
en

Slug Generator

Web

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

Lowercase it and swap the spaces for hyphens sounds like the whole job, but a real slug generator has to handle four things that recipe gets wrong: diacritics (Café Zürich should become cafe-zurich, not caf-z-rich with the letter dropped), runs of separators (Hello World! must not produce two hyphens), a length limit (a long slug gets cut by the CMS, and it picks where), and Chinese. Chinese gets its own option because all three answers are defensible: pinyin (ni-hao-shi-jie) is readable and typeable, keeping the characters works fine in modern browsers and search engines, and dropping them is right only when the Chinese is an aside. Pinyin is the default. Paste several titles, one per line, and each line gets its own slug. Everything runs in your browser; the titles never leave it.

Features

  • Diacritics are stripped with Unicode NFD decomposition, not a hand-written table, so stacked marks (Vietnamese) work too
  • Chinese can be turned into pinyin, kept as is, or dropped; mixed Chinese and English keeps both, in order
  • Runs of separators collapse into one and leading or trailing ones are removed
  • Truncates at word boundaries, never mid-word (how-to-deploy-a-static-site at 16 becomes how-to-deploy-a)
  • Non-ASCII scripts (Cyrillic, Greek, Arabic, Thai) are treated as separators rather than left as unreadable percent-encoded runs
  • Several titles at once, one slug per line, each copyable on its own
  • Underscore separator available for snake_case sites
  • Case can be preserved when you want Hello-World instead of hello-world

How to use

  1. Paste your titles, one per line
  2. Pick how Chinese should be handled and which separator to use
  3. Set a length limit if you need one; the cut lands on a word boundary
  4. Copy a single line or the whole list

FAQ

Should Chinese become pinyin or stay as characters?
Both work, and it is a judgement call about your site. Pinyin (ni-hao-shi-jie) is readable, typeable, and safe in any older system, which is why Chinese sites usually pick it. Keeping the characters means the address bar shows %E4%BD%A0%E5%A5%BD…, but copying, sharing and search engines all handle it correctly, and modern browsers render the characters back. The one case to avoid is a URL that will end up in logs or email through older systems, where the percent-encoded form is both unreadable and easily truncated.
Why does Øre become re while Öre becomes ore?
Ö is written as a base letter plus a combining mark, so Unicode decomposition splits it into O and the mark, and removing the mark leaves the O. Ø (U+00D8) is a standalone letter with nothing to decompose — it stays Ø and is then dropped as non-ASCII. That is the honest boundary of this approach rather than a defect: keeping it would need a hand-written exception table, and such tables are never complete.
Why not just cut at the Nth character?
Because cutting mid-word leaves an unreadable fragment such as how-to-deplo. Truncation happens on word boundaries here: as many whole words as fit, and a word that does not fit is dropped. The single exception is a limit shorter than the first word — then there is no whole word to keep, so the first word is cut (how-to-deploy at 2 becomes ho), otherwise the result would be empty.
Hyphens or underscores?
Search engines accept both, but hyphens are what nearly every site and blog system defaults to, and Google has said it treats the hyphen as a word separator. Underscores fit places that are already snake_case, such as a family of filenames or an older CMS path. Being consistent across your site matters more than which one you pick.

Related tools