csvjson

Slug Generator

Convert any title or text to a URL-safe slug. Handles accented characters, strips special chars, and collapses whitespace. Choose hyphen or underscore separator.

What the converter does

Strips accented and special characters

Unicode characters like é, ü, ñ are normalized to their ASCII equivalents (e, u, n) before special characters are removed. Héllo Wörld becomes hello-world.

Collapses whitespace and separators

Multiple spaces, tabs, existing hyphens, and underscores are all collapsed into a single separator. Leading and trailing separators are stripped.

Lowercases everything

URL slugs are conventionally lowercase. Mixed-case input is fully lowercased so My Blog Post and MY BLOG POST produce the same slug.

Choose your separator

Hyphen (-) is the SEO standard — Google treats hyphens as word separators. Underscore (_) is common in Python/Django projects. Pick based on your framework convention.

Examples

What gets converted and how

Input
My Blog Post Title: Best Practices for 2024!
Slug
my-blog-post-title-best-practices-for-2024
Input
Product Name — Extra-Large (XL) / Blue
Slug
product-name-extra-large-xl-blue
Input
Héllo Wörld: Ünïcödé Éxamplé
Slug
hello-world-unicode-example
Input
How to Use React Hooks in Next.js 14
Slug
how-to-use-react-hooks-in-next-js-14

Frequently asked questions

Should I use hyphens or underscores in URLs?

Google recommends hyphens (-) as word separators in URLs. The Webmaster guidelines explicitly state that hyphens are treated as word separators while underscores (_) are not — 'my-post' is treated as two words while 'my_post' is treated as one. Use hyphens unless your framework requires underscores.

Does slug format affect SEO?

Yes, in a few ways. Shorter slugs with relevant keywords perform slightly better. Using hyphens helps Google parse individual words for indexing. Removing stop words (a, the, in, for) from slugs is a common practice for keeping them short, though it has minimal measurable impact at the page level.

What characters are kept in the slug?

Only lowercase a-z, digits 0-9, and the chosen separator (- or _) appear in the output. Accented characters are first converted to their unaccented equivalents. All other characters — punctuation, symbols, non-Latin scripts — are removed.

Can I generate slugs programmatically?

In JavaScript: text.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g,'').replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,''). In Python: import re; import unicodedata; slug = re.sub(r'[^a-z0-9]+', '-', unicodedata.normalize('NFD', text.lower()).encode('ascii','ignore').decode()).strip('-').

What about slugs with non-Latin scripts (Chinese, Arabic, etc.)?

This tool removes non-ASCII characters after normalization, which would strip Chinese, Arabic, and other non-Latin scripts entirely. For multilingual slugs, use a library like python-slugify or slug.js that includes transliteration tables for non-Latin scripts.