Where kebab-case is used
- URL slugs:
/my-first-blog-post/. Google recommends hyphens rather than underscores to separate words in URLs. - CSS classes and custom properties:
.nav-item,--accent-color. - HTML attributes and custom elements:
data-user-id,<my-widget>(custom elements must contain a hyphen). - Command-line flags and package names:
--dry-run,react-router.
Making a clean URL slug
Punctuation is removed and words are split on spaces, underscores and camelCase boundaries. For slugs, also consider dropping filler words (“a”, “the”, “of”) and keeping it short — three to five words is plenty. Accented letters are kept; replace them by hand if your system needs plain ASCII URLs.
Why “kebab”?
The words look skewered on a stick: words-on-a-skewer. It's also called dash-case, hyphen-case, spinal-case or lisp-case.


