Skip to content
Announcing the new Pro Zone. Check it out!

Naming Convention Explained – Camel vs Pascal vs Kebab vs Snake Case

A naming convention is a pattern generally accepted as a suitable format for naming coding entities like variables, functions, and properties.

Why the Need for a Naming Convention?

Most computing languages do not allow using spaces to separate words when naming your code.

For instance, the snippet below will throw an error because it uses space to separate the variable’s name.

let number of oranges = 235;

Try Editing It

The four popular naming conventions developers use instead of the space-separated entity naming style are:

  • camelCase
  • PascalCase
  • kebab-case
  • snake_case

Let’s discuss the four.

What Is camelCase?

Camel case (also called medial capitals) has the following naming convention:

  • Use lowercase for the first letter.
  • Capitalize the initial letter of each word.

Some examples are:

  • iPhone
  • eBay
  • freeCodeCamp

What Is PascalCase?

Pascal case (also called upper camel case) has the following naming style:

  • Use uppercase for the first letter.
  • Capitalize the initial letter of each word.

Some examples are:

  • CodeSweetly
  • JavaScript
  • GitHub

What Is kebab-case?

Kebab case uses a dash (hyphen) character between words.

Some examples are:

  • margin-top
  • border-radius
  • grid-template-columns

What Is snake_case?

Snake case uses underscores (_) between words.

Some examples are:

  • favorite_countries
  • color_of_the_snow