Skip to content
Case Converter Online
en

Slugify: URL Slug and Handle Generator

Paste one title per line and get a clean, lowercase URL slug for each. Pick hyphens or underscores, convert accented letters and trim long slugs at a word break.

Options

What a slug is

A slug is the part of a web address that identifies one page in words. In example.com/blog/creme-brulee-recipe, the slug is creme-brulee-recipe. Content systems such as WordPress, Shopify and most static site generators build slugs from page titles. Shopify calls them handles.

A good slug is easy to read, easy to type and safe in any browser. That means lowercase letters, digits and a single separator between words. No spaces, no punctuation, no accents that turn into long %C3%A9 codes when the link is copied.

This tool does that conversion for a whole list at once, one slug per line.

How to use the slug generator

  1. Paste your titles into Titles, one per line. Each line becomes one slug, and blank lines stay blank so the output lines up with your list.
  2. Read the results in Slugs and press Copy.
  3. Change the options at the bottom to suit your site:
    • Separator: hyphen, underscore, dot or none.
    • Max length (0 for no limit): the longest slug you want. Long slugs are cut at the last whole word that fits.
    • Lowercase: on by default. Turn it off to keep capitals.
    • Convert accents (é to e): replaces accented and special Latin letters with plain ones.
    • Remove stop words: drops short filler words such as the, a, to, and, of and for.

The line under the tool shows how many slugs you made and the length of the longest one.

Examples

These slugs come from running the generator on each title.

Title Option Slug
10 Tips & Tricks for Café Owners default 10-tips-and-tricks-for-cafe-owners
10 Tips & Tricks for Café Owners Remove stop words 10-tips-tricks-cafe-owners
Why Your Sourdough Isn’t Rising (and How to Fix It) default why-your-sourdough-isnt-rising-and-how-to-fix-it
Why Your Sourdough Isn’t Rising (and How to Fix It) Max length 20 why-your-sourdough
Straße, Łódź und Ørsted: A Guide default strasse-lodz-und-orsted-a-guide
Straße, Łódź und Ørsted: A Guide accents kept straße-łódź-und-ørsted-a-guide
The Best Way to Learn a Language Remove stop words best-way-learn-language
Crème Brûlée Recipe underscore creme_brulee_recipe
Hello World Lowercase off Hello-World
Hello World no separator helloworld

How it works

Each line goes through the same steps:

  1. An ampersand becomes the word “and”, and apostrophes are removed, so “Isn’t” becomes “isnt” rather than “isn-t”.
  2. If accent conversion is on, letters such as ß, æ, ø and ł are spelled out, then Unicode normalization splits letters like é into e plus an accent mark, and the mark is dropped.
  3. The text is lowercased if that option is on.
  4. Every run of letters and digits becomes a word. Everything else, including punctuation and extra spaces, is a break between words.
  5. Stop words are removed if you asked for it. If a title is made only of stop words, they are kept so the slug is not empty.
  6. The words are joined with your separator and trimmed to the maximum length at a word boundary.

Everything happens in your browser.

Tips for good slugs

  • Keep them short. Three to six meaningful words is usually enough. Use Max length or Remove stop words to trim long titles.
  • Do not include dates unless the date is the point of the page. A slug without a year can be updated later without a redirect.
  • Pick one style and keep it. Mixing hyphens and underscores across a site looks messy and makes links harder to guess.
  • Change slugs with care. Once a page is live and linked, a new slug breaks old links unless you set up a redirect from the old address.
  • Check for duplicates. Two posts with the same title will get the same slug. Most systems add -2 to the end, but it is better to make the titles different.

Other ways to make a slug

In JavaScript, a quick version for plain English text is:

'Hello World'.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '')

That returns hello-world. It does not handle accents, so Café would lose its last letter. Python has the python-slugify package, and most frameworks include a slug helper, such as Str::slug in Laravel and slugify in Django.

In a spreadsheet you can chain LOWER and SUBSTITUTE, but accents and punctuation need one SUBSTITUTE each, so pasting the list here is quicker.

For variable names rather than web addresses, use the kebab case converter. To encode text that must stay exactly as typed inside a link, use the URL encoder. To add campaign tracking to the finished link, use the UTM generator.

Slug Generator: questions and answers

What is a URL slug?

A slug is the readable part of a web address that names a page, such as best-way-learn-language in example.com/blog/best-way-learn-language. Good slugs are short, lowercase and use hyphens between words.

Should I use hyphens or underscores in slugs?

Use hyphens for web pages. Google's own guidance recommends hyphens to separate words in URLs, because underscores can be read as joining words together. Underscores are fine for file names, database keys and some social handles.

What happens to accents and letters like ß or ø?

With Convert accents (é to e) switched on, accented letters lose their marks and special Latin letters are spelled out. Straße becomes strasse and Łódź becomes lodz. Switch it off to keep the original letters, which also keeps non-Latin scripts such as Cyrillic.

Why did one of my lines come out empty?

The line had no Latin letters or digits after conversion. A title written only in Cyrillic, Greek or Chinese, for example, has nothing left when accents are converted to plain ASCII. Turn off Convert accents (é to e) to keep those letters in the slug.

Does removing stop words help SEO?

Shorter slugs are easier to read and share, and dropping words like the, a and to is a common way to shorten them. It is a style choice rather than a ranking trick. Keep any word that changes the meaning.

More code and data tools

See all tools