Skip to content

snake_case Converter

Convert any text or camelCase to snake_case. Free online snake_case converter for Python, Ruby, SQL, and database column names.

A snake_case converter replaces the spaces between words with underscores and lowercases everything, producing names like user_first_name. It is the standard identifier style in Python, Ruby, and SQL.

Examples

InputOutput
user first nameuser_first_name
getUserByIdget_user_by_id
HTTP-Response-Codehttp_response_code

When to use the snake_case converter

snake_case is the house style wherever readability of long identifiers matters more than brevity:

  • Python. PEP 8 mandates it for functions, variables, and module names.
  • Ruby and Rails. Methods, variables, and — crucially — database column names, which Rails maps to model attributes by convention.
  • SQL. Most databases fold unquoted identifiers to a single case, so userFirstName and userfirstname collide. Underscores keep column names readable without quoting.
  • Rust. Functions and variables, enforced by the compiler's non_snake_case lint.

The converter reads existing case boundaries, so getUserById correctly becomes get_user_by_id — you do not need to add spaces first. If you need the uppercase variant for constants, use the CONSTANT_CASE converter.

Frequently asked questions

Can it convert camelCase to snake_case?

Yes. The converter detects the capital letters that mark word boundaries, so getUserById becomes get_user_by_id in one step.

What is the difference between snake_case and SCREAMING_SNAKE_CASE?

They use the same underscore separators, but SCREAMING_SNAKE_CASE is uppercase and reserved for constants. Use the CONSTANT_CASE converter for that variant.

Why do databases prefer snake_case?

Unquoted SQL identifiers are case-folded, which makes camelCase column names collapse into an unreadable run of letters. Underscores survive folding and keep names legible.