Skip to content
Toolcroft

Slug Generator - Convert Text to URL Slug

Text Tools

Create URL slugs with ASCII transliteration or Unicode preservation, choose a separator, and trim at word boundaries within a hard character limit.

Turn off to preserve Unicode letters and numbers.

Your slug will appear here…

How to use this tool

  1. Enter your text. Type or paste the title, heading, or phrase you want to convert into the input box.
  2. Choose a separator. Select hyphen (-), underscore (_), or dot (.) as your word separator. Hyphen is recommended for most URLs.
  3. Set options. Choose ASCII transliteration for supported accented Latin characters or turn it off to preserve Unicode letters and numbers. You can also change case or set a maximum length.
  4. Copy the slug. Click "Copy" next to the generated slug to copy it to your clipboard.

What makes a good URL slug?

A well-formed URL slug is short, descriptive, and contains only lowercase letters, numbers, and hyphens. It should reflect the content of the page. Search engines use the slug as a relevance signal, and users see it in the browser address bar and in shared links.

  • Use hyphens, not underscores (Google treats hyphens as word separators).
  • Keep it under 75 characters when possible; long slugs get truncated in SERPs.
  • Remove stop words ("a", "the", "and") manually unless they are meaningful; this tool keeps them.
  • Choose ASCII transliteration for supported Latin accents or Unicode mode to keep letters and numbers in other scripts.

ASCII transliteration and Unicode slugs

Accented characters like é, ñ, ü, and ç are technically valid in URLs (they are percent-encoded by browsers) but they create ugly, hard-to-share links. Transliteration converts them to their closest ASCII equivalent: "café" -> "cafe", "jalapeño" -> "jalapeno", "straße" -> "strasse". Enable transliteration (it is on by default) to produce clean, broadly compatible slugs. The built-in map covers common Latin characters but does not romanize every writing system; in ASCII mode, unsupported non-ASCII letters may leave no slug. Turn off ASCII transliteration to preserve Unicode letters and numbers, including Cyrillic and CJK text. Browsers may percent-encode Unicode in a shared URL depending on the platform. In both modes, an ampersand becomes "and" before separators are added.

Separator choice

For public-facing URLs (blog posts, product pages, landing pages), use a hyphen (-). Underscores (_) are common in file systems and Python package names. Dots (.) are occasionally used in versioned documentation paths. All three options produce valid URLs.

Max length

Many content management systems impose a slug length limit. WordPress defaults to 200 characters; Shopify trims at 255. For SEO best practice, keep slugs under 75 characters. Enable the max length option to stay within a hard character cap. When the next complete word will not fit, the tool drops it and any following words. If the first word alone exceeds the limit, the tool shortens that first word to fit; this is the only case where the word itself is cut, because preserving it would break the configured cap.

CMS behavior differences

PlatformMax slug lengthAuto-generation
WordPress200 charactersGenerated from post title on save
Shopify255 charactersGenerated from product title; editable
Next.jsNo built-in limitManual - developer defines slug generation logic
Ghost CMS191 charactersGenerated from post title; editable
Contentful256 charactersNo auto-generation; set manually

Dynamic slug generation (JavaScript)

To generate slugs programmatically in JavaScript or TypeScript:

const slugify = (text) =>
  text.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');

For production use with accented characters, consider the slugify npm package or a Unicode-aware transliteration library.

Unique slug strategies

When a slug already exists (e.g., a second blog post titled "My Vacation"), avoid collisions with one of these strategies:

  • Auto-increment suffix: append -2, -3, etc. (e.g., WordPress behavior). Simple and predictable.
  • UUID fragment: append the first 8 characters of a UUID (e.g., my-vacation-a3f2c1b4). Guaranteed unique but less readable.
  • Date prefix: prepend the publish date (2025-06-my-vacation). Works well for news sites where articles share titles on different dates.

Frequently asked questions

What is a URL slug?

A slug is the human-readable portion of a URL that identifies a specific page. For example, in "example.com/blog/my-great-post", the slug is "my-great-post". Slugs are lowercase, use hyphens instead of spaces, and contain only URL-safe characters.

Why are hyphens preferred over underscores in slugs?

Google treats hyphens as word separators (so "my-blog-post" is indexed as three separate words) but treats underscores as word joiners ("my_blog_post" is indexed as one word). For SEO, hyphens are the best practice for blog posts and page URLs.

What does transliterate do?

ASCII transliteration converts supported accented Latin characters to ASCII: "café" becomes "cafe" and "straße" becomes "strasse". It does not romanize every writing system, so some non-Latin text can produce an empty slug in ASCII mode. Turn off ASCII transliteration to preserve Unicode letters and numbers, such as "Привет-мир" or "你好-世界". Ampersands become "and" in either mode.

When should I use a max length?

Many CMS platforms (WordPress, Shopify, etc.) impose slug length limits. Set a max length when your publishing platform requires one. The generator keeps complete words when possible; if the first word alone exceeds the limit, it shortens that word to honor the hard cap.

Browse all text tools