What is snake_case?
snake_case writes every word in lowercase and joins them with underscores. The name comes from the snake-like shape of the underscores running along the baseline of the text.
snake_case examples
- hello world example → hello_world_example
- UserFirstName → user_first_name
- max retry count → max_retry_count
Where is snake_case used?
snake_case is the convention for variables and functions in Python (recommended by PEP 8), Ruby and Rust, and it is the dominant style for SQL table and column names. It is also popular for file names and for JSON keys in APIs that value readability.
snake_case and its relatives
Replacing the underscores with hyphens gives kebab-case; uppercasing everything gives CONSTANT_CASE, also called SCREAMING_SNAKE_CASE. This converter understands all of these styles as input, so pasting camelCase or kebab-case text converts cleanly.