What is the snake_case Converter?
snake_case writes words in small letters with an underscore between them, like "user_first_name". It is the usual style in Python, Ruby and database column names.
Tick the box to make CONSTANT_CASE in capitals, which is used for fixed values. Each line is converted on its own.
How to use it
- Type or paste your text in the left box.
- The result shows on the right as you type. Each line becomes a snake_case name.
- Press Copy or Save to take the text away.
Why people like this tool
Many lines
Each line is converted by itself.
CONSTANT_CASE
One tick for all capital names.
Splits camelCase
userName becomes user_name.
Private
Nothing leaves your browser.
Examples
| You type | You get |
|---|---|
| user first name | user_first_name |
| getTotalPrice | get_total_price |
| background-color | background_color |
| max file size (CONSTANT_CASE ticked) | MAX_FILE_SIZE |
Where snake_case is used
- Python: the official style guide (PEP 8) asks for snake_case in function and variable names.
- Ruby and Rust: methods and variables use snake_case too.
- Databases: table and column names like
created_atororder_totalare easy to read in SQL. - Fixed values: CONSTANT_CASE such as
MAX_RETRIESis the common way to name values that never change.
Moving code from JavaScript to Python? Paste all the camelCase names, one per line, and copy the whole result in one go.