kebab-case Converter

Convert any phrase into kebab-case — all lowercase, words joined by hyphens. Standard for URL slugs, CSS class names, and HTML attribute names.

Example: User Profile Background Coloruser-profile-background-color

kebab-case (sometimes called dash-case, hyphen-case, or lisp-case) is a naming convention where words are written in lowercase and joined by hyphens. It's the dominant style for URL slugs, CSS class names, HTML data-* attributes, and most config-file keys.

Search engines treat hyphens as word separators inside URL slugs but treat underscores as connectors — so my-blog-post ranks for "my blog post" while my_blog_post is read as one token. That's why kebab-case is the URL-slug standard regardless of which case style the rest of your codebase uses.

When to use it

URL slugs

Every URL slug on this site (/word-counter, /typing-test-5-minutes) is kebab-case. SEO best practice: hyphens, not underscores; lowercase only.

CSS class names

BEM, Tailwind, Bootstrap, and most CSS frameworks use kebab-case classes. .btn-primary, .card-header, .is-active.

HTML data attributes

data-user-id, data-toggle, data-bs-target. These convert to camelCase automatically when accessed via JavaScript's dataset property.

Command-line flags

Long-form CLI options use kebab-case: --dry-run, --no-cache, --output-format. Short single-character flags use a single dash: -v.

File names and config keys

Modern config formats (YAML, TOML) and most static-site generators (Jekyll, Hugo) prefer kebab-case keys for human-readable file names and front-matter fields.

How the conversion works

The converter processes input by first normalizing Unicode (NFKC) to decompose special characters into base forms. It then splits the string on non-alphanumeric boundaries (whitespace, underscores, punctuation, etc.), discarding any non-[A-Za-z0-9] characters. Each word is lowercased using full Unicode case mapping, and words are rejoined with hyphens (-). Leading, trailing, and consecutive hyphens are stripped. The algorithm does not preserve acronyms or possessive apostrophes; every contiguous sequence of alphanumeric characters becomes a single word.

How to use it

  1. Paste or type your phrase into the input text area.
  2. Click the 'Convert' button to process the text.
  3. Copy the resulting kebab-case output from the result field.
  4. Paste the slug into your URL, CSS, or config file.

Edge cases this converter handles

Acronyms
Acronyms like 'NASA' become fully lowercase 'nasa', not broken into letters.
Possessives
Apostrophes are removed entirely, so 'John's hat' becomes 'johns-hat'.
Hyphenated words
Existing hyphens are treated as word separators, so 'user-friendly' becomes 'user-friendly' (unchanged).

Pro tips for case conversion

  • For URL slugs, always trim leading and trailing hyphens; this tool does that automatically.
  • Use kebab-case for CSS class names to avoid conflicts with JavaScript camelCase.
  • If your input has already hyphenated words, you can preprocess by replacing hyphens with spaces to force a fresh split.
  • Combine with a JSON validator to generate kebab-case keys for configuration files.

vs other ways to change case

While you can achieve kebab-case conversion via command line or word processor, this tool offers a dedicated, instant solution.

This toolsed commandWord Find/Replace
Ease of useNo setup, one-click conversionRequires command-line knowledge and regexMultiple steps: replace all spaces with hyphens, then Change Case to lowercase
Special charactersAutomatically strips all non-alphanumeric chars except hyphensMust craft regex to handle Unicode and edge casesMay leave punctuation unless manually handled
NumbersPreserves numbers as part of wordsEasily included in regexNumbers are kept by default
Multiple spacesCollapses to single hyphenRequires extra steps to remove consecutive hyphensReplaces each space with a hyphen, leading to double hyphens

A bit of history

The term 'kebab-case' was coined in the early 2000s by programmers humorously comparing naming conventions to food (camelCase, snake_case, kebab-case). It gained widespread adoption with the rise of CSS and URL-friendly slugs, and is a direct descendant of Lisp's tradition of using hyphens in identifiers (lisp-case). Its first recorded use in modern web development appears in the Rails community around 2005.

Common questions about case conversion

Why is it called kebab-case?

The hyphens between letters resemble skewers running through pieces of meat on a kebab. The name dates from the early 2010s among JavaScript developers; "dash-case" and "hyphen-case" are older synonyms.

kebab-case vs snake_case — when do I use which?

kebab-case for URLs, CSS, and HTML attributes (anywhere a hyphen is allowed but an underscore looks weird). snake_case for variable names in Python/Ruby, database columns, and most code identifiers (where hyphens would be parsed as subtraction).

Will kebab-case break my JavaScript code?

Yes if used as a variable or property name — JavaScript reads foo-bar as foo minus bar. kebab-case is for strings (CSS class names, URL slugs, HTML attributes) — never for identifiers in code.

How does Google treat hyphens vs underscores in URLs?

Google explicitly recommends hyphens. Hyphens are word separators (so my-page is read as "my page"); underscores are connectors (so my_page is read as "my_page" — one token). For SEO, always use kebab-case URLs.

Embed our tools on your website

Free for any site. No signup. Iframe loads from our servers and stays up-to-date automatically.

📋 Embed the Word Counter

Copy this snippet (auto-resizes, Copy button works):

Live preview:

📋 Embed this kebab-case Converter

Copy this snippet (auto-resizes, Copy button works):

Live preview:

Want more options? All embeddable tools →