Camel case, snake case and other popular letter cases.

Camel case, snake case and other popular letter cases.



With this post, I would like to clarify something that we use every day when we name files, folders, emails, etc. The Letter Cases. Letter case (or just case) is the distinction between the letters that are in larger uppercase or capitals and smaller lowercase in the written representation of certain languages. In computer programming are a set of rules to be used for identifiers. That denote variables, types, functions, files, directories, and other entities.

Most popular letter cases


Case Example Description
Flat case - lettercase
- flatcase
Spaces and punctuation are removed and all the letters are lowercase.
Camel case - letterCase
- camelCase
Spaces and punctuation are removed and the first letter of each word after the first one is capitalised.
Pascal case - LetterCase
- PascalCase
Spaces and punctuation are removed and the first letter of each word after the first one is capitalised.
Snake case - letter_case
- snake_case
Punctuation is removed and spaces are replaced by single underscores. Normally the letters share the same case.
Kebab case - letter-case
- kebab-case
Similar to snake case, above, except hyphens rather than underscores are used to replace spaces.
Doner case - letter|case
- doner|case
Punctuation is removed and spaces are replaced by pipes. Very common as an OR symbol.
Train case - Letter-Case
- Train-Case
Like the kebab case but every word is capitalised,
Upper flat case - LETTERCASE
- UPPERFLATCASE
Spaces and punctuation are removed and all the letters are capitalised.
Macro case - LETTER_CASE
- MACRO_CASE
Spaces and puntctuation are replaced by single underscores, and all letters are capitalised.
Cobol case - LETTER-CASE
- COBOL-CASE
Spaces and punctuation are replaced by hyphens and all letters are capitalised.
Studly caps - LeTTeRCaSe
- stUdLYcApS
Mixed case with no significance to the use of the capitals. Sometimes only vowels are upper case, but often it is simply random.


My favorite letter case

PascalCase + snake_case

A mix between Pascal case and Snake case make the best combination for my daily tasks (coding, naming files, naming conventions for systems, etc.) The great advantage of using this mix allows the creation of multiple hierarchies in the same string.

For example, you can create a naming convention using underscores for each level and Capitals two distinguish between words.

Example: Index_FirstLevel_SecondLevel

Example: 01_ProjectName_TaskName


Main letter cases

Camel case or Dromedary case

Example: "camelCase" "letterCase"

Spaces and punctuation are removed and the first letter of each word is capitalised. When the first letter of the first word is lowercase ("iPod", "eBay"...), the case is usually known as lower camel case or dromedary case (illustratively: dromedaryCase). This format has become popular in the branding of information technology products and services.

Pascal case

Example: "PascalCase" "LetterCase"

Spaces and punctuation are removed and the first letter of each word after the first one is capitalised. If this includes the first letter of the first word, the case is sometimes called upper camel case (or, illustratively, CamelCase), Pascal case, or bumpy case.

Snake case

Example: "snake_case" "letter_case"

Punctuation is removed and spaces are replaced by single underscores. Normally the letters share the same case (e.g. "UPPER_CASE_EMBEDDED_UNDERSCORE" or "lower_case_embedded_underscore") but the case can be mixed, as in OCaml modules. The style may also be called pothole case, especially in Python programming, in which this convention is often used for naming variables. Illustratively, it may be rendered snake_case, pothole_case, etc.

Kebab case

Example: "kebab-case" "letter-case"

Similar to snake case, above, except hyphens rather than underscores are used to replace spaces. It is also known as spinal case, param case, Lisp case, and dash case (or illustratively as kebab-case). If every word is capitalised, the style is known as train case (TRAIN-CASE)

Train case

Example: "Train-Case" "Letter-Case"

A mix between Camel case and Kebab case. spaces are replaced by single hyphens, punctuation are removed and the first letter of each word is capitalised.

Macro case

Example: "MACRO_CASE" "LETTER_CASE"

Punctuation is removed, all the letters are capitalised and spaces are replaced by single underscores. It may be referred to as screaming snake case (or SCREAMING_SNAKE_CASE) or hazard case.

Cobol case

Example: "COBOL-CASE" "letterCase"

Punctuation is removed, every word is capitalised and spaces are replaced by single hyphens. Named from the COBOL programming language. COBOL is primarily used in business, finance, and administrative systems for companies and governments.

Studly caps

Example: "sTudLy cApS" "LeTTeR CaSe"

Mixed case with no semantic or syntactic significance to the use of the capitals. Sometimes only vowels are upper case, at other times upper and lower case are alternated, but often it is simply random. The name comes from the sarcastic or ironic implication that it was used in an attempt by the writer to convey their own coolness. It is also used to mock the violation of standard English case conventions by marketers in the naming of computer software packages, even when there is no technical requirement to do so – e.g., Sun Microsystems' naming of a windowing system NeWS. Illustrative naming of the style is, naturally, random: stUdlY cAps, StUdLy CaPs, etc.

References and links