snake_case Converter

Convert any text to snake_case — lowercase with underscores between words. The Python, Ruby, and Rust convention.

Input
Output

What is snake_case?

snake_case is a naming convention where all letters are lowercase and words are separated by underscores. The name comes from the way the underscores connect the words at ground level, like a snake.

It's the standard convention in Python, Ruby, Rust, SQL, and most Unix-derived contexts.

When to use snake_case

  • Python variables and functions — PEP 8 mandates snake_case.
  • Ruby methods and variables.
  • Rust function and variable names.
  • SQL column and table names.
  • YAML and TOML keys in configuration files.
  • Bash variables and shell-script identifiers.
  • Database identifiers across most RDBMS conventions.

How snake_case conversion works

  1. Input is tokenized using the smart tokenizer: spaces, hyphens, dots, slashes split words; camelCase humps split (so getUserNameget + User + Name); ALLCAPS acronym runs are recognized as single tokens (so HTMLParser becomes html_parser, not h_t_m_l_parser).
  2. Each word is lowercased.
  3. Words are joined with a single underscore between them.

Worked examples

Input snake_case
user name user_name
XMLHttpRequest xml_http_request
getElementById get_element_by_id
isUserLoggedIn is_user_logged_in

Related case formats

Need more conversion options?

Open the full converter →