Slug generator

Convert any text to a URL-friendly slug: lowercase, kebab-case, accents stripped

Input text

Slug

hello-world-this-is-a-url-friendly-slug

TL;DR

What is Slug generator?

A URL slug is the human-readable portion of a URL that identifies a specific page, post, or resource. Slugs are lowercase, use hyphens as word separators, and contain only URL-safe characters (ASCII letters, digits, hyphens). For example, the title "What is a JWT?" becomes the slug "what-is-a-jwt".

Common use cases

  • Blog and CMS: generate a permalink slug from an article title automatically
  • Database IDs: create stable, readable identifiers for records that appear in public URLs
  • File naming: sanitize an arbitrary string into a safe file or directory name
  • SEO: well-formed slugs improve URL readability and are a minor ranking signal

Frequently asked questions

Should I use hyphens or underscores in slugs?

Use hyphens. Google treats hyphens as word separators in URLs, which helps with keyword matching. Underscores are treated as part of a word (hello_world is one word to Google). RFC 3986 allows both, but hyphens are the web convention for slugs.

How are accented characters handled?

Accented characters (é, ñ, ü) are normalized using Unicode NFD decomposition and their combining accent marks are stripped, leaving the base Latin character (e, n, u). This produces clean ASCII slugs from non-English titles without percent-encoding.

See also

  • URL encoder: if a slug must include non-ASCII characters that cannot be stripped, percent-encode them before embedding the slug in a URL
  • Case converter: convert a phrase to kebab-case or snake-case as an alternative to a full slug transformation