Title or text

Slug

What is the URL Slug Generator?

You wrote a blog post titled "How to Parse a URL in JavaScript — A Café Owner's Guide (2026 Edition)" and now you need a URL path for it. You don't want %E2%80%94 in there, you don't want spaces, you don't want capitalization that breaks on case-sensitive servers. You want how-to-parse-a-url-in-javascript-a-cafe-owners-guide-2026-edition. That's what this does. Paste the title, copy the slug. The term itself comes from publishing — see Wikipedia's entry on slugs for the etymology.

The algorithm is the standard one. Lowercase, then run String.prototype.normalize('NFD') to decompose Unicode characters into base letter plus combining marks. Strip the marks (so é becomes e). Handle a few common ligatures by hand — æ becomes ae, ø becomes o, ß becomes ss, ł becomes l. Replace any run of non-alphanumeric characters with a single hyphen. Trim leading and trailing hyphens. Cap at 80 characters at a word boundary so you don't end up with a slug truncated mid-word.

Why kebab-case? Because hyphens are the convention. Google's URL structure guidelines recommend hyphens over underscores for word separation in URLs — search engines parse hyphens as word boundaries. RFC 3986 defines the unreserved characters in a URL path (letters, digits, hyphen, period, underscore, tilde) and most slug conventions stick to a subset of those. Snake_case (my_post_title) and Title-Case-Slug (My-Post-Title) are alternates you'll see, but kebab-case lowercase is the default everywhere from clean URL practice to most CMS defaults.

How to Use the Slug Generator

Three steps. Each one matches a button on this page.

1

Paste a Title or Load the Sample

Drop a title, headline, product name, or any text into the left panel. Click Sample to load a realistic example with em-dashes, accents, and parentheses — the kind of title that breaks naive slug code. Sample input:

How to Parse a URL in JavaScript — A Café Owner's Guide (2026 Edition)

Anything goes — emoji, accented letters, smart quotes, em-dashes, double hyphens, multiple spaces. The slug comes out clean.

2

Read the Slug

The right panel shows the slug as you type. Lowercase, hyphenated, ASCII-only, capped at 80 characters at a word boundary. If the input contained no slug-able characters (e.g. only emoji or only punctuation) you'll see a friendly note instead of a confusing empty result.

3

Copy or Download

Click Copy to send the slug to your clipboard, or Download to save it as a .txt file. Use Clear on the input panel to start over with a new title.

When You'd Actually Use This

Blog post URLs

Your CMS auto-generates slugs but they're ugly — strips accents wrong, leaves underscores, doesn't handle smart quotes. You paste the title here, get a clean slug, paste it back into the URL field. Works for WordPress, Ghost, hand-rolled Next.js blogs, anything that lets you override the slug.

Product or category URLs in e-commerce

Marco Rivera adds a new product called "Crème Brûlée Set — 4 Pack (Limited Edition)". The URL needs to be /products/creme-brulee-set-4-pack-limited-edition, not /products/Crème+Brûlée+Set+%E2%80%94+4+Pack+%28Limited+Edition%29. Slug it, plug it in.

File names from human-supplied titles

You're saving uploaded documents to disk and the customer typed "Q4 Report — Final (v3).docx" as the title. You don't want that as a filename. Slug the title, append .docx, write the file. Works the same way for S3 keys, GitHub branch names from issue titles, and Slack channel names from project names.

Migrating content from a different CMS

Priya Patel is moving 800 articles from a legacy CMS to a new one and the source titles have inconsistent encoding — some accented, some not, some with emoji from a 2018 redesign. Run each title through the slugger, dedupe, and you have your new URL map ready for the redirect table.

Common Questions

Why do you strip accents instead of percent-encoding them?

Because the slug is meant to be human-readable. café in the slug becomes %C3%A9 in the wire URL, which looks awful in a browser bar, breaks copy-paste in chat, and confuses non-technical readers. Stripping to ASCII keeps the URL readable and SEO-friendly. NFD normalization is the standard way to do that decomposition.

What about non-Latin scripts — Chinese, Arabic, Hindi?

NFD doesn't decompose ideographs or scripts that don't have base+combining-mark structure. So a title in Chinese will produce an empty slug here, and you'll see the "no slug-able characters" message. For non-Latin scripts you have two options: transliterate first (using a library like ICU or unidecode), or use the original script in the URL — modern browsers and Google handle Unicode in URLs fine, just less prettily.

Why cap at 80 characters?

No hard rule, but URLs that exceed ~80 characters in the path segment start to wrap badly in emails, social previews, and printed media. Google's guidance doesn't set a number but recommends "simple, descriptive" URLs — long ones are neither. The cap finds the last hyphen before 80 chars to avoid a mid-word cut.

Can it handle emoji?

Yes. Emoji get stripped along with other non-alphanumeric characters. So "🎉 New Launch! 🚀" becomes new-launch. If your slug ends up empty (only emoji input), you get the friendly empty-slug note instead of a broken URL.

What's the difference between this and URL-encoding the title?

URL-encoding keeps every character but escapes the unsafe ones — so spaces become %20, accents become percent-escaped UTF-8 bytes. The result is a valid URL but unreadable. A slug is a different thing: a human-friendly path segment that throws away the characters that don't belong. Use URL-encoding for query parameters, slugs for path segments. The WHATWG URL Standard has the precise definitions for both.

Should I use kebab-case or snake_case?

Kebab-case (my-post-title) for URLs — that's the convention and it's what search engines treat as word separators. Snake_case (my_post_title) is fine for variable names and database identifiers, but in URLs underscores often get treated as part of the word, which hurts SEO. This tool defaults to kebab. If you need snake, find-and-replace the hyphens in the output.

Other URL & Text Tools

A slug is one piece of a URL. Here's what else pairs with it: