We use cookies

We use cookies and similar technologies to enhance your browsing experience, analyze site traffic, and personalize content and ads. By clicking "Accept", you consent to our use of cookies. Learn more in our Privacy Policy.

Free · in your browser · no signup

Slug Generator

Turn any title or sentence into a clean, lowercase, hyphen-separated URL slug — instantly, in your browser.

URL slug

A slug is the human-readable part of a URL that identifies a page, like the post-title section of a blog address. This tool takes any title or phrase and turns it into a clean slug: lowercase, words joined by hyphens, accents normalized to plain ASCII, and punctuation and stray symbols stripped out. Paste a title, get back something safe to drop straight into a route, a filename, or a CMS permalink field.

Everything happens in your browser. The text you type is processed locally with JavaScript and is never sent to a server, so you can run product names, draft headlines, or internal document titles through it without anything leaving your machine. There's no account, no rate limit, and no upload step. It's meant to be the small utility you reach for when you're naming a page and want a predictable, URL-safe result instead of hand-editing spaces and capital letters every time.

How it works

The tool runs a short, predictable pipeline over your input:

  1. Lowercase the whole string, so My Post and my post produce the same slug.
  2. Normalize accented characters to their ASCII base where possible, so Café becomes cafe and naïve becomes naive.
  3. Replace any run of non-alphanumeric characters (spaces, punctuation, symbols, emoji) with a single hyphen.
  4. Collapse repeated hyphens into one, so a -- b doesn't yield a---b.
  5. Trim leading and trailing hyphens, so a title ending in ? doesn't leave a dangling -.

The result only ever contains a-z, 0-9, and -. That character set is safe in a URL path without percent-encoding and works equally well as a filename on every common operating system. Because the steps are deterministic, the same title always produces the same slug, which matters when you need stable, reproducible links.

A worked example

Suppose you're publishing an article titled:

How to Deploy Node.js in 2024 — A Beginner's Guide!

Walking through the pipeline:

  • Lowercase: how to deploy node.js in 2024 — a beginner's guide!
  • The . in node.js, the spaces, the em dash, the apostrophe, and the ! are all non-alphanumeric, so each run becomes a hyphen.
  • Collapse and trim the hyphens.

Final slug:

how-to-deploy-node-js-in-2024-a-beginner-s-guide

Notice two things. node.js becomes node-js, not nodejs, because the dot is treated as a separator rather than removed. And beginner's becomes beginner-s, because the apostrophe is also a separator. If you'd rather have beginners or nodejs, edit the title before generating, or tidy the slug afterward. Slug generation is intentionally conservative: it never guesses which characters you meant to keep, it just guarantees the output is valid.

Common use cases

Slugs show up anywhere a name needs to become a stable identifier:

  • Blog and CMS permalinks — turning a post title into the /blog/<slug> segment.
  • Static site routes — generating page paths in frameworks that map files to URLs.
  • Filenames — naming exports, assets, or generated documents so they sort predictably and survive being copied between systems.
  • API resource identifiers — when you want a readable key (/projects/internal-dashboard) instead of a numeric ID.
  • Anchor IDs — converting section headings into id attributes for in-page links.
  • Branch or ticket names — collapsing a feature description into something git-friendly.

The common thread is wanting a value that is readable by a human, safe in a URL or path, and identical every time it's derived from the same source string.

Tips and gotchas

A few things that trip people up:

  • Slugs aren't unique by themselves. Two different titles can collapse to the same slug (for example C++ and C both reduce toward c). If you store slugs as keys, add a uniqueness check and append a counter like -2 when a collision happens.
  • Numbers survive, but the meaning can drift. Top 10 becomes top-10, which is fine, but a title that's only symbols (like !!!) reduces to an empty string. Have a fallback ready.
  • Editing a published slug breaks links. Once a URL is live and indexed, changing its slug returns a 404 for anyone holding the old link. Set up a redirect if you must rename.
  • Non-Latin scripts mostly drop out. Characters that have no ASCII equivalent are removed, so a fully Cyrillic or CJK title can yield an empty slug. For those cases you'll want a transliteration step before slugging.

Why URL-safe characters matter

URLs have a defined grammar. The path segment allows unreserved characters (A-Z a-z 0-9 - . _ ~) directly; anything else must be percent-encoded, so a space becomes %20 and an accented é becomes a multi-byte %XX%XX sequence. Encoded URLs still work, but they're ugly to read, easy to mangle when copied into chat or email, and inconsistent across tools that encode differently.

By restricting output to lowercase letters, digits, and hyphens, a slug sidesteps all of that. The hyphen is the conventional word separator because it's unreserved and search engines treat it as a word boundary, whereas underscores are sometimes read as joining two words. Lowercasing matters too: URL paths are case-sensitive on most servers, so My-Page and my-page can resolve to different resources. Forcing lowercase removes a whole class of "works on my machine" bugs where a link breaks only because someone typed a capital letter.

Tips

  • Generate the slug from the final title, not a draft — renaming a live URL later breaks existing links and search rankings.
  • Keep slugs reasonably short; the meaningful keywords near the front matter more than including every word of a long title.
  • If you store slugs as database keys, enforce uniqueness in code and append a numeric suffix on collisions.
  • Drop filler words like 'a', 'the', and 'of' from the title before generating if you want a tighter slug.
  • For non-Latin titles, transliterate to ASCII first, otherwise the slug can come out empty.
  • Set up a redirect from the old slug to the new one whenever you have to change a published URL.

How to use Slug Generator

  1. 1Type or paste a title, heading, or sentence.
  2. 2The slug is generated live below as you type.
  3. 3It's lowercased, trimmed, and non-alphanumeric runs become single hyphens.
  4. 4Copy the slug into your CMS, blog, or route — nothing is uploaded.

Frequently asked questions

What is a URL slug?

It's the readable identifier in a URL that names a specific page, usually derived from its title. In `example.com/blog/getting-started`, the slug is `getting-started`.

Why are slugs lowercase?

URL paths are case-sensitive on most web servers, so `My-Page` and `my-page` can point to different resources. Forcing lowercase keeps links consistent and avoids accidental 404s.

Should I use hyphens or underscores in a slug?

Hyphens. Search engines treat a hyphen as a word separator, while underscores can be read as joining two words together. Hyphens are the widely followed convention for URLs.

What happens to accented or special characters?

Accented letters are normalized to their plain ASCII equivalent where one exists (`é` to `e`), and any remaining symbols, punctuation, or spaces become hyphens. The output only contains a-z, 0-9, and -.

Is the slug guaranteed to be unique?

No. Different titles can reduce to the same slug, so if you use slugs as identifiers you should add a uniqueness check in your own system and append a suffix like -2 when needed.

Does the text I enter get sent anywhere?

No. Slug generation runs entirely in your browser with JavaScript. Nothing you type is uploaded or stored on a server, so it's safe for unpublished titles and internal names.

Can I use a slug as a filename?

Yes. The lowercase, hyphenated, ASCII-only output is valid on every common operating system, sorts predictably, and survives being copied between machines without encoding issues.

My title produced an empty slug — why?

That happens when the title is made up entirely of characters that get stripped, such as pure punctuation or a script with no ASCII equivalent. Add some Latin text or transliterate the title first.

← All toolsRead our guides →