Skip to content
ToolkitHub

Text to Slug Generator

Convert text to URL-friendly slugs

Guide

What makes a good URL slug

By Logappradeep · ServiceNow developer

A slug is the human-readable part of a URL that identifies a page, such as url-encoding-explained in /blog/url-encoding-explained. Good slugs make links easier to read, share, and remember, and they give both people and search engines a hint about the page's topic before it is opened. The term comes from newspaper publishing, where a slug was a short working name for a story.

How this generator builds a slug

  1. Replaces & with "and" and @ with "at", and transliterates letters such as ß to ss and ø to o.
  2. Removes accents from letters, so é becomes e and ü becomes u.
  3. Turns every other character that is not a letter, digit, space, underscore, or hyphen into a word break.
  4. Lowercases the text and joins words with a single separator, either a hyphen or an underscore.
  5. Trims separators from the start and end.

For example, 10 Tips & Tricks for Node.js! becomes 10-tips-and-tricks-for-node-js, and Café Crème Brûlée becomes cafe-creme-brulee. The result updates as you type.

ASCII-only or Unicode slugs

With ASCII only enabled (the default), the slug contains only a–z, digits, and the separator, which is the safest choice for every browser, CMS, and analytics tool. The downside is that scripts without a Latin transliteration, such as Hindi, Chinese, or Arabic, are dropped entirely, so a title written only in those scripts produces an empty slug. Turn the option off to keep letters from any script, producing slugs like नमस्ते-दुनिया. Those are valid in modern browsers but are percent-encoded in many contexts and become long strings of % codes when copied into emails or logs.

Guidelines for slugs that age well

  • Keep it short and descriptive. Three to six meaningful words usually describe a page better than a full sentence.
  • Prefer hyphens. Search engine documentation recommends hyphens as word separators in URLs, and they are easier to see than underscores when a link is underlined. Use underscores only when a system requires them.
  • Drop words that will go stale. Years, version numbers, and words like "new" date a slug quickly. best-laptops outlives best-laptops-2024 if you plan to update the page.
  • Avoid changing published slugs. Every change breaks existing links and bookmarks. If you must change one, set up a permanent (301) redirect from the old URL.
  • Make them unique. If two posts produce the same slug, add a distinguishing word or a short suffix such as -2.

Watch symbols that carry meaning

Symbols other than & and @ simply become word breaks, so a title like C++ vs C# turns into c-vs-c and loses its meaning. Write a slug such as cpp-vs-csharp by hand in cases like that. Likewise, version numbers such as v2.1 become v2-1, which is usually fine but worth checking.

Slugs are generated locally in your browser.

Frequently asked questions

Should I use hyphens or underscores in URLs?

Hyphens. They are widely recommended as word separators in URLs and are easier to read than underscores, which can hide under link underlines.

Why is my slug empty?

The title probably uses a script without a Latin transliteration, and ASCII only mode removes it. Turn ASCII only off, or write a short Latin slug by hand.

Do stop words like "the" and "a" hurt SEO?

Not meaningfully. Removing them can make slugs shorter and cleaner, but keep them if the slug reads better with them.

Can I change a slug after publishing?

You can, but set up a 301 redirect from the old URL so existing links and search rankings carry over.