snake_case converter
Converted in your browser · nothing is uploaded
Converts text to snake_case: everything lowercase, words joined with underscores. `User First Name` becomes `user_first_name`.
How to use the snake_case converter
snake_case is the convention in Python, Ruby, Rust and. Most consequentially. In SQL. The SQL reason is worth knowing because it explains a class of bug: unquoted identifiers in SQL are case-insensitive, and PostgreSQL folds them to lowercase. So a column created as firstName is really firstname, and querying SELECT "firstName" with quotes fails while SELECT firstName works and returns firstname. Using snake_case avoids the whole problem, which is why almost every database convention mandates it.
SCREAMING_SNAKE_CASE. The same thing in capitals: is the near-universal convention for constants and environment variables. Environment variables are conventionally uppercase for a historical reason that still bites: shell variable names are case-sensitive, and uppercase distinguishes exported configuration from local shell variables. A lowercase env var works but reads as a mistake to anyone else.
When converting from camelCase, the boundary is found at each capital letter, so firstName becomes first_name and parseHTTPResponse becomes parse_h_t_t_p_response, which is why the acronym advice on the camelCase page matters. Text that was written parseHttpResponse round-trips cleanly; text with a run of capitals does not.
Questions
Unquoted SQL identifiers are case-insensitive and PostgreSQL folds them to lowercase, so firstName silently becomes firstname. snake_case avoids it entirely.
Constants and environment variables. Uppercase distinguishes exported configuration from local shell variables.
The boundary is each capital, so parseHTTPResponse becomes parse_h_t_t_p_response. Write acronyms as ordinary words and it round-trips.
Python, Ruby, Rust and SQL. It is the default in all of them.
No. The conversion happens in your browser.