Saved

Press the star next to a tool's name to save it.

All my tools

Slug Generator

This slug generator turns a title or phrase into a clean URL slug: accents are removed, punctuation dropped and words joined with a hyphen, underscore or dot.

Each line becomes its own slug.

Everything is worked out in your browser. Nothing you type is sent anywhere.

Slug

Your slug will appear here.

A slug is the readable part of a web address that names a page, such as the words after the last slash in a blog post URL. A good slug is short, lowercase and made of plain words joined with hyphens. This slug generator turns any title or phrase into such a slug in one step, handling accents, punctuation and spaces for you.

What the slug generator does

Type or paste a title, one per line if you have several, and press the button. Each line is turned into a slug: accented letters become plain letters, punctuation is dropped, spaces and other gaps become your chosen separator and capital letters become lowercase. You can then switch on stop-word removal, set a maximum length and decide whether letters from other scripts should be kept. The slugs appear in the result box, one per line, with a Copy button.

What a slug is for

The Wikipedia article on clean URLs says a URL slug is usually the end part of the URL that names the resource, often built from the page title, and that slugs are often described as identifying a page with human-readable keywords. [1] It adds that a typical slug is lowercase, converts accented characters to Latin letters and replaces spaces with a hyphen or underscore so they do not need to be encoded, with punctuation generally removed and short common words sometimes dropped. [1] This tool follows exactly that pattern, so its output is a good starting point for a blog post, product page or file name.

Why only certain characters

Web addresses may only contain a limited set of characters without being encoded. RFC 3986 defines the unreserved characters as letters, decimal digits, hyphen, period, underscore and tilde. [2] Anything else, such as a space or an accented letter, has to be written as a percent sign followed by hexadecimal digits, which makes an address long and hard to read. By default the slug generator keeps only the letters a to z and the digits 0 to 9 and joins words with a hyphen, underscore or dot, all of which are unreserved.

How accents are handled

Titles written in French, German, Spanish and many other languages are full of accents. The tool first splits each accented letter into a base letter and a combining mark with the Unicode normalisation form NFKD, then removes the marks. MDN describes this form as compatibility decomposition, which splits precomposed characters into a base character followed by combining marks and also replaces compatibility characters such as ligatures. [3] So é becomes e, ñ becomes n and the ligature ff becomes two letters f.

A few letters do not decompose, so the tool maps them by hand: ß becomes ss, æ becomes ae, œ becomes oe, ø becomes o, đ and ð become d, ł becomes l and þ becomes th. If you untick the accents option, accents are left in place, which only makes sense together with the option to keep letters from other scripts.

Options in detail

OptionWhat it doesExample
SeparatorHyphen, underscore or dot between wordsmy-post, my_post, my.post
LowercaseTurns capitals into lowercaseMy Post becomes my-post
Remove stop wordsDrops 21 short common English words such as a, the, of and toThe Best of the Web becomes best-web
Keep other scriptsKeeps letters and digits from any scripta Japanese title stays readable
Maximum lengthCuts the slug at a whole worda limit of 9 turns one-two-three into one-two

Apostrophes are removed without leaving a gap, so "dog's" becomes "dogs" and "it's" becomes "its". If every word of a title is a stop word, the tool keeps them rather than return an empty slug.

Worked example

The title "This, That, and the Other! An Outré Collection" turns into this-that-and-the-other-an-outre-collection with the default settings. With stop-word removal on, the words and, the and an are dropped and you get this-that-other-outre-collection, which matches the example given in the Wikipedia article on clean URLs. [1] Choosing the underscore separator gives this_that_other_outre_collection.

Several titles at once

Every non-empty line of the box becomes its own slug on its own line, so you can paste a whole list of titles from a spreadsheet and copy all the slugs back. The summary line tells you how many slugs were made and how long the longest one is, which helps you stay within the limits of your content system. Empty lines are skipped.

Step by step

  1. Paste one or more titles, one per line.
  2. Pick the separator and the options you want.
  3. Optionally enter a maximum length.
  4. Press Generate slug.
  5. Copy the slugs.

Good slug habits

Keep slugs short, descriptive and stable. Once a page is live and linked from elsewhere, changing its slug breaks those links unless you set up a redirect. Avoid dates and numbers that will go out of date, avoid repeating the same word and put the main keyword near the start. All processing happens in your browser, so your titles are never sent anywhere.

What next

Use this often? Add Slug to your Home screen.

Frequently asked questions

How does the slug generator work?

It removes accents, drops punctuation, joins the remaining words with the separator you choose and lowercases everything. Optional stop-word removal and a maximum length are available.

Which separator should I use in a slug?

A hyphen is the most common choice for web addresses. Underscores and dots are also allowed, and you can pick any of the three in the tool.

Can the slug generator handle accented letters?

Yes. Accents are stripped, so é becomes e, and letters such as ß, æ and ø are mapped to plain letters by hand.

What does the stop words option remove?

It removes 21 short English words such as a, an, the, of, to and with. If every word of a title is a stop word, they are all kept.

Is my text sent to a server?

No. The slugs are made in your browser and your titles never leave your device.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Developer Tools