There is PascalCase, camelCase and snake_case. The popular case types. But one case type that is always unknown is the case with a hypen. It is usually lower case and includes a "-". So how do we call it?
The most common name how this case is called is kebab-case.
Overall, there are a lot of names of this case type and over time it evolved a lot and there is still no official name even though most people use kebab-case.
The most used name for this case is kebab-case. And it has a simple reason. The pattern looks like a kebab. A kebab is a dish, normally some form of meat on a skewer. If you put this kebab horizontally, then you have a structure like:
You can always see a letter and then a part of the skewer. This is where the name kebab case is coming from.
Other than kebab-case, the hyphenated case also has a lot of different names that we will cover in this chapter. These are alternatives and can be used, but we recommend to stick to the name kebab-case.
hyphen-case is probably the most natural name to choose for this type of casing. It is simple. A "-" is officially called hyphen. So that is where the name is coming from. This name is not often used though. Reasons? We do not know. It seems like the community likes to have a more thoughtful name for this case type.
Similar to the kebab, the spine of a human has the same structure as a kebab. You have kind of a skewer which is the core of your spine. These are the "-" in the case type. And then you have different segments of your spine. These are the letters or parts of words used that are then connected via the hyphens. A nice representation can be found below.
This name for the hyphen case is based on the other cases we have already. Long before the case was created a lot of other case types like camelCase or snake_case existed. So it was the logical conclusion to also choose another animal that fits this case. People chose the caterpillar. It has different paths and is basically built up like a spine or kebab.
Dash case is really similar to hyphen-case. The "-" is also called dash. Even though it is not as widely used it is a valid form of this case type.
A slug is coming from the SEO world. Basically it is a relative part within an URL. Like caseconverter.pro/blog/name-of-hyphen-separated-case where "name-of-hyphen-separated-case" is the slug. Basically it is the part that describes the page in detail. Wordpress, and especially yoast, drove the usage of this name.
Another framework that pushed that name is Django, a popular Python web framework. They are using the word "slugify" a lot when trying to convert a string to a valid kebab-case URL segment.
This name is coming as well from the SEO world. Google, the biggest search engine in this world, stated that it is easier for their search algorithms to parse URL paths with "-". Other combinations like PascalCase, camelCase or snake_case are more difficult to parse, or at least harder to associate. Nowadays the indexing algorithm by Google will probably understand all cases but the safest bet is to use kebab-case. But based on that the name friendly-url-case was also created. Because it made URLs friendly to get parsed by Google, Bing, DuckDuckGo and similar.
There are also some other names that are probably used in the wild world. But it is a subset caused by languages, for example "lisp-case" or "css-case". This is most likely caused by language specifics that make certain identifiers in these languages case-sensitive. And this leads to have the developer using kebab-case for certain things. In CSS, for example, it is favored to use kebab-case for classes because otherwise class names could clash and cause bigger problems in styling a website.
As we can see there are a lot of names for this exact case. Overall, we recommend to use kebab-case though because it is the most widely used name for this case type nowadays.
For the hyphen-separated case there are multiple names: kebab-case, hyphen-case, slug-case and many other options... But what is the right one to choose. This article will help you to make a decision.
The reasons why we love our technology stack at caseconverter.pro are quite diverse. Read it here and gather insightful statistics about which technologies were used and why you should use them too.