snake_case Converter
Convert any phrase into snake_case — all lowercase, words joined by underscores. Default identifier style for Python, Ruby, and most SQL columns.
User Profile Background Color → user_profile_background_color
Convert any phrase into snake_case — all lowercase, words joined by underscores. Default identifier style for Python, Ruby, and most SQL columns.
User Profile Background Color → user_profile_background_color
snake_case is a naming convention where words are written in lowercase and joined by underscores. It's the official identifier style for Python (per PEP 8) and Ruby, and it's overwhelmingly the most common style for SQL column names across PostgreSQL, MySQL, and SQLite.
Compared to camelCase, snake_case is easier to read at a glance because the underscores act as visual separators, but it's slightly slower to type because every word break requires a dedicated keystroke. Languages and ecosystems pick one or the other and stick to it for consistency.
Per PEP 8, every Python variable, function parameter, and method name should be snake_case: user_id, compute_tax_rate, read_from_file. Class names are PascalCase; constants are CONSTANT_CASE.
Ruby methods, variables, and Rails model attributes are all snake_case. Database columns convert automatically to snake_case attribute names in ActiveRecord, so any deviation breaks the magic.
PostgreSQL, MySQL, and SQLite are all case-insensitive for unquoted identifiers, but snake_case is the de-facto standard. created_at, user_email, order_total.
snake_case is friendly for filenames and URL slugs that need underscores rather than dashes. (For URL slugs, kebab-case is more common — Google treats hyphens as word separators in URLs but underscores as connectors.)
While environment variables are conventionally CONSTANT_CASE, the underscore separator is the same. snake_case is one toUpperCase() away from a valid env var name.
The snake_case converter applies a deterministic pipeline. First, it splits the input string into words by detecting boundaries: whitespace, hyphens, underscores, and case transitions (e.g., from lowercase to uppercase). Each boundary is treated as a word separator. Then every word is lowercased. Finally, the words are joined with a single underscore (_).
Acronyms (e.g., HTTP) are treated as single words during splitting because they consist entirely of uppercase letters; after lowercasing, they become http. Possessives (e.g., user's) lose the apostrophe and s during word splitting because the apostrophe acts as a non-alphanumeric delimiter. Hyphenated words (e.g., well-known) naturally split at the hyphen. The algorithm does not preserve original letter case beyond detection of word boundaries.
While you can achieve the same result with command-line tools or word processors, this converter is purpose-built for speed and accuracy.
| This tool | sed command | Word "Change Case" | |
|---|---|---|---|
| Case handling | Converts all characters to lowercase. | Requires explicit lowercasing via y or tr. | Only offers UPPERCASE, lowercase, Title Case. |
| Word splitting | Detects spaces, hyphens, underscores, and case transitions. | Must manually define delimiters (e.g., sed 's/[ _-]/-/g'). | Does not split words; only changes case of entire selection. |
| Output format | Directly yields snake_case with underscores. | Needs extra pipe to replace spaces with underscores. | Cannot produce snake_case natively; requires manual replacement. |
The snake_case naming convention became prominent with the rise of Python and Ruby in the 1990s and early 2000s. Python's PEP 8 (2001) officially recommended snake_case for variable and function names, while Ruby's community adopted it for methods and symbols. Its roots trace back to C's underscore-separated identifiers (e.g., MAX_LENGTH), but the lowercase variant emerged as a more readable alternative to camelCase in dynamically typed languages. The term "snake_case" itself was popularized by Ruby enthusiasts in the early 2000s.
It depends on your language and team conventions. Python, Ruby, and most databases prefer snake_case. JavaScript, Java, C#, Swift, and Kotlin prefer camelCase. The rule is to follow your language's official style guide and your team's existing code — never mix conventions inside one codebase.
Underscore-prefixed names like _private often signal "internal use only" in Python and Ruby. Double underscores (__name__) are reserved for language-defined identifiers. Our converter strips leading and trailing underscores from regular phrases — add them back manually if you need them.
Digits stay where they are: "version 2 alpha" → "version_2_alpha". A digit immediately after a letter is not separated unless the input has a space or punctuation between them.
The all-lowercase letters with underscore breaks visually resemble a snake slithering across the page. The name was popularised in the early Ruby community in the mid-2000s.