Text to Slug
Convert text into SEO-friendly URL slugs.
100% client-side processing
Length: 0 chars Truncated
This text-to-slug converter turns any title or phrase into a clean, URL-safe slug with your choice of separator, case handling, and optional stop-word removal. It is built for bloggers naming posts, developers generating routes or file names, and SEO-conscious writers who want tidy permalinks.
How to Use
- Enter text — type your article title, product name, or any phrase. The default sample, “10 Tips for Better JavaScript Code”, shows the output immediately.
- Choose a separator — hyphen, underscore, or none. Hyphens are the web standard; underscores suit code; none suits compact identifiers.
- Set the maximum length — 200 characters by default. Set 0 to disable truncation.
- Toggle lowercase — on by default for consistent, case-insensitive URLs.
- Toggle stop-word removal — off by default; turn it on to drop common English filler words.
- Copy — the slug and its character count update live, with a badge if the result was truncated.
What the Converter Actually Does to Your Text
The transformation runs in a fixed order, and the order explains most surprising results:
- Lowercase (if enabled) is applied to the whole string first.
- Trim removes leading and trailing whitespace.
- Stop-word removal (if enabled) splits on whitespace and drops exact matches from a fixed English list.
- Separator substitution replaces runs of spaces and underscores with your separator.
- Character filtering deletes anything that is not a Unicode letter, a Unicode number, or your separator.
- Collapse and trim reduces repeated separators to one and strips separators from both ends.
- Truncate cuts at the last separator before the limit if the slug is too long.
Worked Examples
| Input | Options | Slug |
|---|---|---|
| 10 Tips for Better JavaScript Code | hyphen, lowercase, no stop words | 10-tips-for-better-javascript-code |
| 10 Tips for Better JavaScript Code | hyphen, lowercase, stop words on | 10-tips-better-javascript-code |
| The Ultimate Guide: React & TypeScript! | hyphen, lowercase, stop words on | ultimate-guide-react-typescript |
| My File Name (v2) | underscore, lowercase | my_file_name_v2 |
| Café au Lait & Crème | hyphen, lowercase | café-au-lait-crème |
| A Very Long Descriptive Blog Post Title About Modern Web Development | hyphen, max 40 | a-very-long-descriptive-blog-post |
The third row shows the two-stage effect: “The” is removed as a stop word, while “Guide:” keeps its colon until filtering, then loses it. The last row shows truncation landing on a separator boundary rather than cutting a word in half.
Stop-Word Removal: What It Really Matches
The built-in list covers roughly fifty common English words: articles (a, an, the), conjunctions (and, or, but), prepositions (in, on, at, to, for, of, with, by, from), and forms of be, have, do, and the modals. Two limits matter. First, matching is exact after lowercasing, so “The” is removed but “the” inside a hyphenated compound is not a separate token. Second, removal happens before punctuation filtering, so a token like “and,” will not match. If a stop word still appears in your slug, inspect the input for attached punctuation. Turning the option off is often better for short titles, where every content word carries weight.
Choosing Separators and Length Limits
Google parses hyphens as word boundaries, which is why react-tips is read as two words while react_tips is treated as one token. Use hyphens for anything that will be crawled and indexed. Underscores are fine for file names and internal identifiers, and the none option is best for slugs that will be used as keys rather than read by humans. For length, keep public slugs under about 60 characters so they are not truncated in search snippets. The 200-character default is generous; lower it per project to enforce your own ceiling, and watch for the truncated badge that warns you the cut was applied.
Common Mistakes
- Keyword stuffing. A slug like
best-cheap-affordable-budget-laptops-dealsreads as spam. Pick the three to five words that genuinely name the page. - Changing a live slug without a redirect. Once a URL is indexed, editing it discards the ranking the old address earned. Set up a 301 to the new slug.
- Assuming non-Latin text is stripped. It is preserved. If a target system requires ASCII, transliterate before pasting.
- Using the none separator for public URLs. It produces unreadable strings like helloworld and removes word boundaries entirely.
- Expecting stop-word removal to catch every filler word. The list is fixed and English-only; brand words and non-English articles pass through.
Handling Non-Latin and Mixed-Script Text
The filter uses Unicode property classes, so a slug keeps letters and numbers from every script while discarding punctuation and symbols. “東京 2024 旅行” becomes 東京-2024-旅行, and “Café Münster” becomes café-münster. That behaviour is correct for many modern frameworks, but it comes with two practical caveats. First, browsers percent-encode non-ASCII characters when building the URL, so the address bar may display a long string of %E6%9D%B1 sequences; the slug still works, but it is less readable and harder to say aloud. Second, some hosting setups, older CMS platforms, and analytics tools handle non-ASCII paths inconsistently. If your audience or toolchain expects ASCII, transliterate the text before pasting — for example, convert 東京 to tokyo and ü to ue or u — then run it through the converter. The tool itself does not transliterate, and it should not guess, because romanisation rules differ by language.
Related Tools
Frequently Asked Questions
Does stop-word removal delete words attached to punctuation?
No. The converter splits on whitespace and compares whole tokens, so 'the' is removed but 'the,' or 'the.' is not matched and survives until punctuation stripping removes the comma or period. Clean, separately spaced stop words are the ones that disappear.
What happens when I set max length to 0?
Zero disables truncation entirely: the slug is returned at full length. Any value above 0 is a hard ceiling, and when the slug is longer the converter cuts at the last separator before the limit and shows a truncated badge.
Are accented and non-Latin letters kept?
Yes. The filter keeps any Unicode letter or number, so café becomes café and 日本語 stays 日本語. The tool does not transliterate; if you need ASCII-only slugs, convert the text first or use a separate transliteration step.
What does the 'none' separator option produce?
It joins every word with no character between them. 'Hello World' becomes helloworld, and all spaces, underscores, and punctuation are simply removed. This is useful for filenames and identifiers but is not recommended for public URLs.
Why is my slug shorter than the number of letters I typed?
Spaces, punctuation, and symbols are stripped, and consecutive separators collapse into one, so the slug length is usually far below the original character count. The tool reports both the original length and the final slug length so you can see the difference.
Does it change underscores that are already in my text?
Yes. Existing underscores are treated like whitespace and replaced with your chosen separator. With hyphens selected, 'my_file_name' becomes my-file-name rather than keeping its underscores.
Reviewed by the HandyTools Hub team · Last updated