Kebab Case Converter

Convert text to kebab-case, the convention for CSS classes, HTML attributes and URL slugs.

53Characters
5Words
3Lines

Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.

What the Kebab Case Converter does

This kebab case converter will convert text to kebab-case, the convention for CSS classes, HTML attributes and URL slugs. Paste your text in, pick the options you need, and copy the result straight back out. It is most often used for naming CSS classes and custom properties. You may also want the pascal case converter.

How to use it

  1. Paste or type your text into the input box.
  2. The target case is already selected — change it from the dropdown if you need a different one.
  3. The converted text appears immediately as you type.
  4. Press Copy to put the result on your clipboard.

How it works

kebab-case is lowercase words joined by hyphens, and it is the convention almost everywhere in the web platform: CSS class names and custom properties, HTML attributes, and URL path segments.

There is a hard constraint behind the convention rather than just a preference. CSS identifiers cannot contain underscores in all contexts without escaping, and JavaScript cannot use a hyphen in a property name without bracket notation — which is exactly why the DOM maps data-user-id to dataset.userId. The two conventions sit on either side of that boundary.

For URLs, Google has long stated a preference for hyphens over underscores as word separators, because hyphens are treated as word boundaries and underscores historically were not.

When to use it

  • Naming CSS classes and custom properties.
  • Creating URL slugs from titles.
  • Naming HTML data attributes.
  • Converting a component name into a file name.

Common mistakes to avoid

  • Using kebab-case for JavaScript variable names, which is not valid syntax.
  • Using underscores in URL slugs, where hyphens are the better word separator for search engines.
  • Leaving trailing or doubled hyphens after converting text with punctuation.

Frequently asked questions

What is kebab-case?

Lowercase words joined by hyphens: primary-button-large. It is the convention for CSS classes, HTML attributes and URL slugs.

Why hyphens rather than underscores in URLs?

Google treats a hyphen as a word separator and historically did not treat an underscore the same way. Hyphens remain the recommended choice.

Can I use kebab-case in JavaScript?

Not for identifiers — a hyphen is the subtraction operator. Object properties in kebab-case need bracket notation, which is why the DOM converts data-user-id to dataset.userId.

Related tools

See all text & writing tools →