What is kebab-case?
kebab-case writes every word in lowercase and joins them with hyphens. The words look as if they are skewered on the hyphens like pieces of a kebab — hence the name.
kebab-case examples
- hello world example → hello-world-example
- main navigation header → main-navigation-header
- UserProfileCard → user-profile-card
Where is kebab-case used?
kebab-case is the standard style for URL slugs, CSS class names and HTML id and class attributes. Web component tag names must contain a hyphen, and many projects name files and CLI flags in kebab-case too — think main-header.css or the --dry-run flag.
kebab-case in code and on the web
Most programming languages read a hyphen as a minus sign, so kebab-case cannot be used for variables — camelCase or snake_case fill that role. For public URLs, however, kebab-case is the recommended choice: search engines treat hyphens as word separators, which makes slugs easier to read and index.