Automatically detect various naming formats and convert to Kebab-case with one click, helping code standardization.
Kebab case (also known as hyphen case) is a naming convention where each word is separated by a hyphen (-) and all letters are lowercase. The name comes from the visual resemblance of the hyphens to skewers holding words together like pieces of meat on a kebab. It is widely used in front‑end development (CSS classes, HTML attributes), URL paths, npm package names, configuration keys, and many other web‑facing contexts. Compared to macro style (all caps with underscores), kebab case prioritizes readability and typing speed, while macro style emphasizes prominence and constant‑value identification.
Every letter must be lowercase – this is the most distinctive feature of kebab case. In contrast to macro style (all uppercase), lowercase text feels softer on the eyes and blends naturally into prose, reducing visual fatigue during long coding sessions.
Words are joined by a single hyphen -, for example user-profile. The hyphen is directly available on the keyboard without needing the Shift key, making it faster to type than underscores.
Identifiers must not start or end with a hyphen, nor contain consecutive hyphens (e.g. user--profile), as these can be misinterpreted by some parsers or cause unexpected behavior.
Numbers are allowed (e.g. version-2), though they are generally not placed at the beginning. For acronyms like API or URL, kebab case treats them as normal words (e.g. api-key), whereas macro style would render them fully uppercase (e.g. API_KEY). This is one of the key differences between the two conventions.
Kebab case dominates the front‑end and web ecosystem, and also plays a significant role in configuration management.
In HTML and CSS, class names and IDs are frequently written in kebab case – for example, nav-bar and btn-primary. CSS property names themselves also use hyphens (like font-size and background-color), ensuring consistency across the stylesheet. Macro style, by contrast, is rarely seen in this domain.
For SEO‑friendly and human‑readable URLs, path segments often use hyphens to separate words, such as /user-profile or /api-version. Many static site generators and CMS platforms recommend this practice, while macro style is almost never used for URLs.
In JSON, YAML, and .env files, keys often adopt kebab case (e.g. max-retry-count), but environment variables typically use macro style (e.g. MAX_RETRY_COUNT). Both have their place: kebab case is more readable, macro style is more visually prominent and signals that the value is a constant.
npm (Node Package Manager) enforces that package names use kebab case and are all lowercase – for example, lodash and express-validator. This makes kebab case the standard within the JavaScript ecosystem.
Although both kebab case and macro style use separators, their domains are completely different. Macro style (all caps + underscores) is primarily used for constants and macros in programming languages, emphasising immutability and visibility. Kebab case, on the other hand, focuses on the web front‑end, URLs, and configuration keys, prioritising readability and user friendliness.
Case difference: macro style is fully uppercase, which draws attention in code and clearly marks constants; kebab case is fully lowercase, visually softer and better suited for user interfaces and textual content.
Separator choice: macro style uses underscores, which are common in variable names, while hyphens in HTML/CSS have a special semantic meaning (e.g. attribute names) – each convention fits its own ecosystem.
Cross‑language compatibility: macro style is supported in virtually every programming language (for constants), whereas kebab case is largely confined to the web and configuration realms, and most programming languages do not allow hyphens in identifiers.
user-avatar is better than ua.id or url), prefer full words.The choice depends entirely on the context:
Our kebab case page is designed to help you understand this convention, while our macro style converter focuses on constant naming. Together, they support overall code quality and consistency.
Kebab case is an indispensable naming convention in the web development world. Its simplicity, readability, and URL‑friendliness have made it the de facto standard for CSS, HTML, and configuration files. At the same time, understanding its differences from macro style equips developers to make the right choice in each context. Whether you are building front‑end components or designing API routes, mastering kebab case will make your code more professional and easier to maintain.