What is kebab-case?
kebab-case is a naming convention where all letters are lowercase and words are separated by hyphens. The name comes from the way hyphenated words look like meat skewered on a kebab. It's also called dash-case, spinal-case, or hyphen-case.
It's the convention for everything web-facing: CSS class names, HTML attributes, URL paths, and command-line flags.
The same words with each one capitalized, as in Content-Type, are Train-Case, the convention for HTTP header names.
When to use kebab-case
- CSS class names:
nav-bar,card-header. - HTML attributes:
aria-label,data-user-id. - URL paths and slugs:
/blog/my-first-post. - Command-line flags:
--user-name,--max-retries. - npm package names: most packages use kebab-case.
- Lisp identifiers: kebab-case has been the Lisp tradition for decades.
- Filenames in many web projects.
How kebab-case conversion works
- Input is tokenized using the smart tokenizer.
- Each word is lowercased.
- Words are joined with a single hyphen between them.
Worked examples
| Input | kebab-case |
|---|---|
user profile |
user-profile |
main heading |
main-heading |
isUserLoggedIn |
is-user-logged-in |
user_agent_string |
user-agent-string |
Related case formats
snake_case
→ Convert text to snake_case
URL slug→ Convert text to URL slug
path/case→ Convert text to path/case
Need more conversion options?
Open the full converter →