Turn phrases or camelCase into snake_case for Python and database names, or CONSTANT_CASE for constants and environment variables.
Examples
User First Name getUserById order-total-amount
user_first_name get_user_by_id order_total_amount
max retry count apiBaseUrl
MAX_RETRY_COUNT API_BASE_URL
Where snake_case is used
- Python: the PEP 8 style guide uses snake_case for variable, function and module names.
- Databases: table and column names such as
created_atoruser_id. - Ruby, Rust and PHP: method and variable names.
- CONSTANT_CASE: constants (
MAX_SIZE) and environment variables (DATABASE_URL) in almost every language.
How the converter splits words
Spaces, hyphens, dots and existing capitals all mark a new word, so getUserById, get-user-by-id and Get user by ID all become get_user_by_id. Apostrophes are dropped, and each line converts on its own.
Frequently asked questions
How do I convert camelCase to snake_case?
Paste your camelCase names above with snake_case selected. Each capital letter starts a new word: firstName → first_name.
What is CONSTANT_CASE?
Also called SCREAMING_SNAKE_CASE: capital letters joined by underscores, like API_KEY. It's used for values that don't change.