Skip to main content
TT

Text to Slug Converter

Turn any title into a clean, URL-safe slug — lowercase, accents stripped, no spaces.

Did you like the tool? Thanks!
Share:
Separator:

How to Use Text to Slug Converter

Type or paste any text and it is instantly converted into a URL-friendly slug: lowercased, with accented letters stripped down to their plain form, every run of anything that is not a letter or digit replaced by a separator, and repeated or edge separators cleaned up. Choose a hyphen or an underscore as the separator and copy the result with one click — everything happens locally in your browser.

About Text to Slug Converter

A "slug" is the part of a URL that identifies a specific page in a readable way — the `my-first-blog-post` in `example.com/blog/my-first-blog-post`, or the `wireless-mouse` in `example.com/products/wireless-mouse`. Slugs matter for three practical reasons: search engines and users can both read them (a URL that spells out the page's topic is more trustworthy and more clickable than an opaque numeric ID), they need to survive being pasted into browsers, chat apps, and HTML attributes without escaping, and they need to stay stable and unique as an identifier over the page's lifetime. None of that works with a raw page title — titles have spaces, capital letters, punctuation, and often accented or non-Latin characters, none of which belong in a URL path segment. This tool automates the standard slugification recipe. First, the input is lowercased, since URLs are conventionally all-lowercase (mixed-case URLs technically work but create duplicate-content and case-sensitivity headaches on servers that treat paths as case-sensitive). Second, accented and decorated Latin letters are reduced to their plain ASCII equivalent — é, è, ê and ë all become e; ñ becomes n; ö becomes o; and Romanian-specific letters like ș and ț (s and t with a comma below) become s and t. This is done with `String.prototype.normalize('NFD')`, which decomposes a precomposed accented character into a base letter plus one or more separate "combining mark" characters (é becomes the letter e followed by a separate U+0301 COMBINING ACUTE ACCENT character); a follow-up regular expression then strips every character in the Unicode combining-marks range, leaving just the plain base letters behind. Third, every run of one or more characters that is not a lowercase a–z letter or a 0–9 digit — spaces, punctuation, symbols, emoji, or accented characters that could not be decomposed to something a–z0–9 — is collapsed into a single separator character. Finally, any separator left at the very start or end of the result is trimmed off, since a slug should never begin or end with a hyphen. You can choose between a hyphen (`-`) or an underscore (`_`) as the separator. Hyphens are the near-universal convention for web URLs — Google's own SEO guidance and virtually every CMS (WordPress, Shopify, etc.) defaults to hyphens because search engines treat a hyphen as a word boundary the way they treat a space, while an underscore is historically treated by some search engines as joining two words into one token. Underscores remain useful outside of URLs, though — file names, database keys, environment variable names and some programming-language identifier conventions often prefer underscores or forbid hyphens entirely (a hyphen is not a legal character in most programming language identifiers, since it reads as a minus sign). Having both available in one tool covers both use cases without needing to run the output through a second find-and-replace pass. One limitation worth knowing: Unicode's NFD decomposition only helps with scripts where accented letters are built from a base Latin letter plus a combining mark — this covers essentially all of the Latin-alphabet languages (French, German, Spanish, Romanian, Vietnamese, Turkish, Polish, and so on). It does not help with non-Latin scripts such as Chinese, Japanese, Korean, Arabic, Hebrew, Cyrillic or Greek, where the characters are not decomposable into an ASCII base letter at all — those characters simply fall outside the a–z0–9 range and get replaced by the separator like any other non-alphanumeric character. If your source text is primarily in one of those scripts, this tool will strip it down to nothing useful, and you should instead type a manual ASCII/Latin-transliterated title in the box for slug generation, since a fully general transliteration system (Cyrillic → Latin, Japanese romanization, and so on) is a much larger and more opinionated undertaking than what a lightweight browser widget can reasonably do correctly.

Details & Tips

Conversion steps, applied in order: 1. Unicode-normalize the input to NFD (Normalization Form Canonical Decomposition), which splits precomposed accented characters into a base character plus separate combining marks. 2. Strip every combining-mark character (Unicode range U+0300–U+036F), which removes the accent while leaving the base letter behind. 3. Lowercase everything. 4. Replace every run of one or more characters that are not `a`–`z` or `0`–`9` with the chosen separator (`-` or `_`). 5. Collapse any run of repeated separators down to a single one. 6. Trim a leading or trailing separator, if the text started or ended with a non-alphanumeric character. Worked example: `Café & Restaurant!!` → lowercase + strip accents → `cafe & restaurant!!` → non-alphanumeric runs (` & `, `!!`) replaced by `-` → `cafe-restaurant-` → trailing separator trimmed → `cafe-restaurant`. Another example with the underscore separator: `10% Off — Today Only!` → `10_off_today_only` (the `%`, em dash and spaces are each part of non-alphanumeric runs collapsed to a single underscore; note the digits `10` are kept, since digits are always allowed in a slug). Why hyphens are the default: search engines and most CMS platforms treat a hyphen the same way they treat a space when tokenizing a URL into words, which is what lets `wireless-mouse` be found by a search for "wireless mouse". Underscores are sometimes treated as joining two words into a single token instead, which is why hyphens are the broadly recommended choice for public-facing URLs — the underscore option here exists for the non-URL cases (file names, keys, identifiers) where a hyphen either is not conventional or is not a legal character at all. What is intentionally not attempted: transliteration of non-Latin scripts (Cyrillic, CJK, Arabic, Hebrew, Greek) into Latin characters. Those characters are not decomposable into an ASCII base letter via Unicode normalization, so they are treated like any other non-alphanumeric character and replaced by the separator — a genuinely correct transliteration system is language- and script-specific and out of scope for a lightweight slugify tool.

Frequently Asked Questions

What is a URL slug?
It is the human-readable part of a URL that identifies a specific page, such as "wireless-mouse" in example.com/products/wireless-mouse. Slugs are lowercase, use a separator instead of spaces, and avoid special characters so they display and copy/paste cleanly everywhere.
Why does this tool remove accents like é and ñ?
URLs are conventionally restricted to plain ASCII letters and digits for maximum compatibility across browsers, servers and copy-paste contexts. Accented letters are reduced to their closest plain-letter equivalent (é → e, ñ → n) rather than being dropped entirely.
Should I use a hyphen or an underscore?
For URLs, use a hyphen — search engines and CMS platforms treat it as a word boundary the same way they treat a space, which is the widely recommended convention. Underscores are more useful outside of URLs, such as in file names or database keys, where hyphens are sometimes not conventional or not allowed.
What happens to numbers in my text?
Digits 0-9 are always kept as-is; only letters are lowercased and accents are stripped. "Top 10 Tips" becomes "top-10-tips".
Does this work with Chinese, Japanese, Arabic or Cyrillic text?
Not usefully — those scripts cannot be reduced to plain a-z letters the way accented Latin letters can, so characters in those scripts are treated as non-alphanumeric and replaced by the separator. For those languages, type a manual Latin-alphabet title for slug generation instead.
Why are repeated separators collapsed into one?
If your text has multiple consecutive spaces or punctuation marks (like "Hello World!!!"), converting each character individually would produce an ugly result like "hello---world". Collapsing repeated separators keeps the slug clean: "hello-world".
Will the slug ever start or end with a hyphen?
No, a leading or trailing separator is always trimmed off, even if your original text started or ended with punctuation or spaces.
Is my text uploaded anywhere?
No, the conversion happens entirely in your browser using JavaScript. Nothing you type is sent to a server.
Does this tool check whether the slug is already used on my site?
No, it only performs the text-to-slug conversion. Checking uniqueness against your existing URLs or database is something your application or CMS needs to handle separately.
What happens with emoji or symbols like $, %, or &?
They are treated as non-alphanumeric characters and replaced by the separator, the same as spaces and punctuation, since they have no meaningful plain-text representation in a URL slug.
Can I convert multiple lines at once?
The textarea accepts multi-line input, but the whole input is treated as a single string and converted into one slug — line breaks are themselves non-alphanumeric characters and get collapsed into the separator just like spaces.
Is uppercase preserved anywhere in the output?
No, the entire result is lowercased, since mixed-case URLs are conventionally avoided to prevent case-sensitivity mismatches on servers that treat URL paths as case-sensitive.

Also Available As

text to slug, slug generator, url slug converter, slugify, string to slug, seo friendly url generator, remove accents from text

Found a Problem?

Let us know if something with Text to Slug Converter isn't working as expected.

Thanks — we'll take a look.