A slug is the URL-friendly version of a string — typically lowercase, with whitespace replaced by hyphens and characters outside a safe ASCII range removed. The term comes from the newspaper industry, where a short label identified an article in production; the web borrowed it for the path segment that names a page, e.g. the my-first-post in /blog/my-first-post.
This generator runs the input through three string operations native to JavaScript. First, String.prototype.normalize("NFD") performs Unicode Normalization Form Canonical Decomposition, which splits an accented character like é into the base letter e plus a combining acute accent (U+0301). A regex then strips the combining-mark range U+0300 to U+036F, leaving the bare ASCII letter behind. Second, the result is lowercased and any character that is not a-z, 0-9, whitespace, or hyphen is removed. Finally, runs of whitespace and hyphens are collapsed into a single chosen separator.
The variants table extends the same base output. kebab-case is what almost every web framework expects in URLs (Django, Rails, WordPress, Ghost, Hugo, Next.js dynamic routes). snake_case replaces hyphens with underscores and is conventional for Python module names, environment variables, and many database column conventions. dot.case is used by some package managers and DNS-flavored identifiers. camelCase and PascalCase are produced by capitalizing the first letter of each word; they are appropriate for JavaScript identifiers and class names but should not appear in URLs.
Use hyphens, not underscores, in URL slugs. Google's documentation on URL structure states explicitly that hyphens separate words and underscores do not — meaning my_article_title is treated as a single token by the search index while my-article-title is read as three. The same advice applies to all the major search engines and most static site generators.
There are real edge cases this simple algorithm cannot handle. Non-Latin scripts (Chinese, Arabic, Japanese, Cyrillic) get stripped entirely because the regex limits output to a-z and 0-9. For proper romanization (transliteration of 你好 to ni-hao, or Привет to privet), use a dedicated library like slugify or unidecode. Emoji are also dropped silently. If you need internationalized URLs (IRIs), modern browsers support them — but most CMSes still convert to ASCII slugs because of legacy systems and analytics tools that mishandle UTF-8 paths.
SEO considerations: keep slugs under five or six words, include the primary keyword, and put the most distinguishing token earliest. Avoid stop words like the, of, and a unless they meaningfully change the meaning. Numbers are fine — dated slugs like 2026-pricing-update tell users and search engines when the content was written. Once a slug is published, do not change it without setting up a 301 redirect, or you will break inbound links and lose ranking.
Everything happens in your browser via these four primitives: String.normalize, String.replace with regex, String.toLowerCase, and String.split. There is no library import and no network request. Closing the tab discards the input.