Solved.tools: Free Online Calculators & Tools

We use cookies for analytics and advertising. Learn more about our cookie policy

Text to Slug Converter

Last updated: 27 June 2026

Reviewed by Gavin Meiring, Lead research and primary author · Doctoral Candidate (Corporate Governance) · Research and drafting assisted by AI

Was this helpful?


Text to Slug Converter

A text to slug converter converts any text into a URL-safe slug by lowercasing, removing special characters, and replacing spaces with hyphens. It is an essential utility for web developers, content editors, and SEO practitioners who need clean, readable, and search-engine-friendly URLs.

How to Use the Text to Slug Converter

  1. Type or paste any heading, title, or phrase into the input field.
  2. Click the convert button.
  3. The tool outputs a hyphenated, lowercase slug with all special characters removed.
  4. Copy the slug and use it in your CMS, routing config, or URL path.
  5. Check the result to confirm it clearly represents the original text.

The Formula

The text to slug conversion process applies a standard sequence of conversions:

  1. Trim leading and trailing whitespace from the input.
  2. Convert all characters to lowercase.
  3. Transliterate accented or non-ASCII characters to their ASCII equivalents (for example, "ü" becomes "u", "café" becomes "cafe").
  4. Remove all characters that are not alphanumeric or spaces.
  5. Replace one or more consecutive spaces or hyphens with a single hyphen.
  6. Strip any remaining leading or trailing hyphens.

The result is a string composed only of lowercase letters, numbers, and hyphens, which is valid in any URL without encoding and readable by both humans and search engines.

Real-World Example

You are adding a new page to your site with the heading "What's the Best Way to Learn Python in 2026?". You need a URL slug for this page.

  1. Lowercase: "what's the best way to learn python in 2026?"
  2. Remove apostrophe and question mark: "whats the best way to learn python in 2026"
  3. Replace spaces with hyphens: "whats-the-best-way-to-learn-python-in-2026"

The final URL becomes yoursite.com/whats-the-best-way-to-learn-python-in-2026, which is clean and descriptive.

Text to Slug vs Slug Generator

Text to slug and slug generator describe the same process. Some tools label this feature "slug generator" when used during content creation to produce a new slug, and "text to slug" when converting an existing string. The underlying conversion is identical. A few advanced versions offer options such as stripping common stop words (to produce shorter slugs) or truncating the output to a maximum character length, which can be useful for platforms with URL length restrictions.

Frequently Asked Questions

What characters are allowed in a URL slug? URL slugs should contain only lowercase letters (a to z), numbers (0 to 9), and hyphens. Avoid underscores (Google does not treat them as word separators), spaces (encoded as %20), and any other special characters, which require percent-encoding and make URLs harder to read and share.

Should I include numbers in my slug? Yes, if the number is a meaningful part of the title, such as a year or a step count. "10-ways-to-save-money" is a perfectly valid slug and the number adds context. Avoid including arbitrary ID numbers unless your CMS requires them.

What happens to emojis and symbols in the title? Most slug converters strip emojis and symbols entirely, since they are not valid URL characters without encoding. If your title contains an emoji, it will simply be removed from the slug, and the surrounding words will be joined with a hyphen.

How long should a slug be? Most SEO practitioners recommend keeping slugs between 3 and 5 meaningful words. Google displays approximately 60 characters in a URL preview in search results, so very long slugs may be truncated. Focus on the most important keywords and omit filler words where the slug remains clear without them.

The steps applied to four titles

The conversion runs in a fixed order: decompose and strip accents, lowercase, delete anything outside a to z, 0 to 9, spaces and hyphens, collapse runs of separators, then trim the ends. The table shows the same four titles at each stage.

| Input | After accents are stripped | After lowercasing | After deleting disallowed characters | Slug | | What's the Best Way to Learn Python in 2026? | unchanged | whats the best way to learn python in 2026? | whats the best way to learn python in 2026 | whats-the-best-way-to-learn-python-in-2026 | | Café Crème | Cafe Creme | cafe creme | cafe creme | cafe-creme | | Straße | Straße | straße | strae | strae | | 50% off! | 50% off! | 50% off! | 50 off | 50-off |

The question mark and the apostrophe are gone by the fourth column, which is the step that makes the string safe for a URL. Collapsing runs of separators is what stops a double space or an existing hyphen from producing two hyphens in a row.

What the accent step handles and what it does not

The step decomposes each character into a base letter and a separate accent mark, then deletes the mark. That covers the accented letters of most Latin-script languages: e with acute becomes e, u with diaeresis becomes u, n with tilde becomes n.

| Input | Slug | Why | | Café Crème | cafe-creme | Both accents decompose and are removed | | Straße | strae | The sharp s has no decomposed form, so it is deleted | | 例え | empty | Neither character survives the allowed set |

The sharp s is the case to watch. German orthography treats it as equivalent to ss, and the standard for internationalised domain names maps it that way, so straße.example resolves as strasse.example. A slug built by deleting the character gives "strae" instead, which reads correctly in English but is not the conventional German spelling. If the slug matters for a German audience, write the ss form by hand after converting.

For a title in a non-Latin script the conversion returns an empty string, because no character in it is in the allowed set. Host names handle those scripts through punycode instead of transliteration: bücher.example becomes xn--bcher-kva.example and 例え.example becomes xn--r8jz45g.example. That encoding applies to the host name, not the path, so a page title in a non-Latin script still needs a transliterated or hand-written slug for its URL path.

Length, encoding and what a URL needs

A URL accepts a limited character set, and every character outside the unreserved set has to be percent-encoded. A slug built from lowercase letters, digits and hyphens needs no encoding at all.

| Character in the path | Where it goes | Reason | | a to z and 0 to 9 | Used as written | Unreserved characters | | hyphen | Used as written | Unreserved | | space | %20 | Does not appear raw in a URL | | accented e | %C3%A9 | Encoded as its UTF-8 bytes | | plus sign | %2B | Reserved, and read as a space in a query string |

That table is the reason for the hyphen convention rather than any cosmetic preference: a hyphen is unreserved and needs no encoding, while a space has to be escaped. Google treats the hyphen as a word separator, so learn-python reads as two words rather than one.

Choosing between a slug and a full title

A slug is a permanent identifier as much as a description. Changing one breaks every link pointing at the old address, so the decision to shorten a title is worth making once and keeping. Two rules carry most of the weight: keep the words a reader would search for, and drop the ones that carry no meaning outside the title.

| Title | Full slug | Length | Stop words removed | Length | | How to Bake Bread at Home | how-to-bake-bread-at-home | 25 | bake-bread-home | 15 | | What's the Best Way to Learn Python in 2026? | whats-the-best-way-to-learn-python-in-2026 | 42 | learn-python-2026 | 16 |

Search results display roughly 60 characters of a URL before truncating, so a slug in the twenties sits comfortably inside the limit and the 42-character example does not. Truncation is not an error, and it does cut off the words at the end, which are often the ones that tell two pages apart.

Titles that need care before converting

Some titles hold characters that the conversion deletes rather than translates, and the result can lose a word boundary.

| Input | Slug | What happened | | FAQ's and Answers | faqs-and-answers | The apostrophe went and the two halves joined | | C# vs C++ | c-vs-c | Both language symbols went, leaving single letters | | Sale/Clearance | saleclearance | The slash went without a separator, so two words merged | | Résumé Tips | resume-tips | The accents decomposed and were removed | | 10 Things I Hate About You (1999) | 10-things-i-hate-about-you-1999 | The brackets went and the year stayed |

The third row changes meaning rather than just trimming the string. Deleting a slash and putting nothing in its place merges the words on either side, so the slug reads as one word where the title had two. Replace the slash with a hyphen by hand, or rewrite the title before converting it.

The brackets and the apostrophe cause no harm, because the words around them do not run together. The rule the table shows is that a deleted character leaves a gap when there was a space or a hyphen beside it, and leaves none when it stood alone between two letters.


Also try these free tools: