snake_case Converter

Turn phrases into snake_case identifiers — the standard for Python variables, Ruby methods and SQL column names.

Convert text into snake_case for Python, Ruby and database fields. Free online developer tool.

snake_case Converter examples

InputOutput
User First Nameuser_first_name
Café Münster IDcafé_münster_id

How the snake_case converter works

  1. Words are detected at spaces, punctuation and camelCase boundaries.
  2. Each word is lowercased and joined with underscores.
  3. Unicode letters and digits survive the conversion.

Rules and edge cases

  • Words are split at spaces, hyphens, dots, punctuation and camelCase boundaries, then joined with a single underscore.
  • Every letter is lowercased, so UserFirstName becomes user_first_name and getHTTPResponse becomes get_http_response.
  • Accented letters and digits are preserved rather than stripped; only separators and punctuation are removed.
  • Repeated separators collapse — "order -- total" produces order_total, never order__total.
  • kebab-case uses hyphens instead of underscores; CONSTANT_CASE is the same shape in capitals.

Frequently asked questions

Where is snake_case the convention?

Python variables and functions (PEP 8), Ruby, Rust, and column and table names in PostgreSQL and MySQL, where unquoted identifiers are folded to lowercase anyway.

What happens to leading digits?

They are kept, so "2 factor auth" becomes 2_factor_auth. Most languages do not allow identifiers to start with a digit, so add a prefix such as two_factor_auth.