Slug Generator - Turn Any Text Into Clean URL Slugs

Turn any title into a URL-friendly slug instantly. Lowercase, hyphenated, no special chars. Free, runs in your browser — no signup needed.

Tool options

Separator

Input
69 chars · 2 lines · 73 bytes
Output

Paste a title. Get a clean, shareable URL slug instantly.

Type or paste any page title, blog post heading, or product name above and this slug generator converts it into a URL-friendly string — lowercase letters, hyphens instead of spaces, no special characters. Copy the result straight into your CMS, router, or database.

Worked example — snippet-bait:
Input: 10 Best Tips, in 2026!
Output: 10-best-tips-in-2026

The four rules applied here: (1) lowercase everything, (2) spaces become hyphens, (3) punctuation is stripped (comma, exclamation mark), (4) repeated hyphens collapse into one. A good slug is also short, readable, and keyword-rich — drop filler words like "in" if the slug gets long.

How to use this slug generator

  1. Type or paste your title into the input box above.
  2. The slug updates as you type — no button needed.
  3. Click Copy to put it on your clipboard.
  4. Paste it wherever you need it: WordPress, Shopify, Next.js, Django, or your own database.

Another worked example

Input titleOutput slug
My Café & Bar Menu — Spring 2026my-cafe-bar-menu-spring-2026
What is OAuth 2.0?what-is-oauth-2-0
Extra Spaces Here extra-spaces-here
Crêpes, Résumés & Naïve Queriescrepes-resumes-naive-queries

Notice how accented characters (é, ê, ï) are transliterated to their plain ASCII equivalents, and the ampersand (&) is removed entirely.

How to generate a URL slug in code

If you need to do this server-side or automate it in a pipeline, here are two minimal, copy-pasteable snippets.

JavaScript (browser or Node.js)

function slugify(text) {
  return text
    .toString()
    .normalize('NFD')                  // split accents from base letters
    .replace(/[\u0300-\u036f]/g, '')   // strip accent marks
    .toLowerCase()
    .trim()
    .replace(/[^\w\s-]/g, '')          // remove non-word chars
    .replace(/[\s_]+/g, '-')           // spaces and underscores to hyphens
    .replace(/--+/g, '-');             // collapse repeated hyphens
}

console.log(slugify('10 Best Tips, in 2026!'));
// => '10-best-tips-in-2026'

Python 3

import re
import unicodedata

def slugify(text: str) -> str:
    text = unicodedata.normalize('NFD', text)          # split accents
    text = text.encode('ascii', 'ignore').decode()     # drop non-ASCII
    text = text.lower().strip()
    text = re.sub(r'[^\w\s-]', '', text)               # remove punctuation
    text = re.sub(r'[\s_]+', '-', text)                # spaces to hyphens
    text = re.sub(r'-+', '-', text)                    # collapse repeats
    return text

print(slugify('10 Best Tips, in 2026!'))
# => '10-best-tips-in-2026'

Popular frameworks include this out of the box — for example, Django has django.utils.text.slugify, and the slugify npm package handles edge cases across dozens of languages.

How it works

The tool runs entirely in your browser using JavaScript. No text is sent to any server — everything happens locally on your device, so your content stays private.

Under the hood it follows five steps in order:

  1. Normalise — Unicode text is decomposed so accented characters (é → e) can be handled cleanly.
  2. Lowercase — all characters are converted to lowercase.
  3. Strip punctuation — anything that isn't a letter, number, space, or hyphen is removed.
  4. Spaces to hyphens — spaces (and underscores) become -.
  5. Collapse & trim — multiple hyphens in a row collapse to one; leading and trailing hyphens are removed.

When to use a slug generator — and when not to

Good times to use it

  • Creating blog post URLs in a CMS like WordPress, Ghost, or Contentful.
  • Generating route paths in frameworks like Next.js, Nuxt, or Rails.
  • Naming product handles in Shopify or WooCommerce.
  • Building anchor IDs for jump links within a long page.
  • Normalising user-submitted data (e.g. tag or category names) before storing it.

When a different approach makes more sense

  • Non-Latin scripts (Arabic, Chinese, Korean): pure ASCII slugs lose all meaning. Consider keeping the original script or using a dedicated transliteration library for the target language.
  • Very long titles: slugs over ~60–70 characters can hurt readability and SEO. Manually trim to your key phrase after generating.
  • Version numbers with dots (e.g. v1.2.3): dots are stripped by default. Keep them if your routing system needs exact version paths, and adjust the regex accordingly.
  • Filenames with extensions: if you need my-file.pdf, strip only the name part and preserve the extension separately.

For guidance on URL best practices, Google's own URL structure documentation recommends short, descriptive, hyphen-separated URLs — which is exactly what a well-formed slug provides.

Bottom line: clean slugs make your URLs readable, shareable, and search-engine friendly. Paste your next title above and grab a perfect URL segment in one click.

Frequently asked questions

Is my text uploaded or stored anywhere?+
No. The slug generator runs entirely in your browser. Your text never leaves your device, so there's nothing stored on any server.
What's the difference between a slug and a URL?+
A slug is just the human-readable part at the end of a URL — for example, my-best-post in https://example.com/blog/my-best-post. The full URL includes the protocol and domain; the slug is only the last piece.
How do I slugify a string in JavaScript?+
Use text.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase().trim().replace(/[^\w\s-]/g, '').replace(/[\s_]+/g, '-').replace(/--+/g, '-'). Or install the slugify npm package for a battle-tested version with wider language support.
How do I slugify a string in Python?+
If you're using Django, from django.utils.text import slugify handles it in one call. For plain Python, use unicodedata.normalize plus a couple of re.sub calls — the snippet on this page is a drop-in copy.
Should slugs use hyphens or underscores?+
Hyphens are strongly preferred for public URLs. Google treats hyphens as word separators (so blue-shoes matches searches for "blue" and "shoes" individually) but treats underscores as connectors. Stick with hyphens unless a specific system requires underscores.
What happens to special characters like accents, Chinese, or emoji?+
Accented Latin characters (é, ü, ñ) are transliterated to their plain ASCII equivalents. Emoji and non-Latin scripts (Chinese, Arabic, etc.) are stripped, which can leave a very short or empty slug — for those, you may want to transliterate or translate the text first, then slugify.
How long should a URL slug be?+
Aim for under 60–70 characters. Shorter slugs are easier to share and read. Drop common filler words (a, the, in, of) to tighten it up, but keep the keywords that matter for search and context.
Is this tool free? Do I need to sign up?+
Completely free, no account needed. Open the page and start generating slugs immediately.