What Is snake_case? Usage and Examples
snake_case writes every letter in lowercase and joins words with underscores (_), named after the way it stretches out low like a snake.
The rules of snake_case
user profile image becomes user_profile_image in snake_case. The underscores make word boundaries clear, which reads well.
The all-uppercase variant is called CONSTANT_CASE (or SCREAMING_SNAKE_CASE) and is used for constants.
Where it is used
- Variable and function names in Python (recommended by PEP 8)
- Database table and column names
- Variable and method names in Ruby
- Keys in configuration files, and file names
Why use snake_case
Underscores give a visual gap similar to a space while keeping the name a single identifier, so even long names stay relatively easy to read.
It also separates words safely in environments that are not case-sensitive, such as some databases.
Moving to and from camelCase
Frontends often use camelCase while backends and databases use snake_case, so converting between them is common. Paste text into the converter to see both formats at once.