Writing
Code
Other
Clean up
Shortcuts: Ctrl/Cmd + Enter copies the result, Ctrl/Cmd + Z undoes the last clean-up.
What snake_case is
snake_case writes everything in lowercase and joins words with underscores, for example user_first_name. It is the usual style in Python, Ruby, SQL column names and many file names.
How to use the converter
Paste a phrase or a camelCase name. With snake_case selected, the result shows the underscore version. Click Copy to use it.
snake_case vs kebab-case
kebab-case uses hyphens instead of underscores, for example user-first-name. It is common in URLs and CSS. CONSTANT_CASE is snake_case in capitals and is used for constants.
Tips
Pick one style and use it consistently. Avoid spaces and special characters in names, and keep names readable.
How the converter builds a name
It splits your text into words, lowercases them and joins them with underscores. Spaces, hyphens, dots and other punctuation are treated as word breaks, repeated separators collapse into one underscore, and names that are already joined are split at their capital letters.
| You type | snake_case result |
|---|---|
user first name | user_first_name |
userFirstName | user_first_name |
getHTTPResponse | get_http_response |
My Blog Post Title! | my_blog_post_title |
Order #42 – shipped (UK) | order_42_shipped_uk |
café au lait | café_au_lait |
Paste several lines and each one becomes its own name, so a column of labels converts in one go. For the shouting version, pick CONSTANT_CASE: max retry count becomes MAX_RETRY_COUNT.
Where snake_case is the norm
- Python: PEP 8 recommends lowercase names with underscores for functions and variables.
- Databases: table and column names such as
created_atare commonly snake_case, because it avoids quoting and case problems. - Other languages: Ruby and Rust use it for variables and functions as well.
- File names and keys: data files, config keys and API field names often use it.
snake_case or kebab-case for web addresses?
For URLs, use kebab-case rather than snake_case. Google's URL structure guidance recommends separating words with hyphens rather than underscores. Use snake_case inside code and databases, and hyphens in page addresses.
Check these before you use the result
- Names cannot start with a digit in most languages, and the converter does not add a letter for you.
- Accented letters are kept. Some older systems only accept plain ASCII names, so remove accents by hand if needed.
- Reserved words are not checked. A name like
classorselectmay be reserved in your language or database.
More converters: Uppercase to Lowercase Converter · Lowercase to Uppercase Converter · Capitalize Text Online · camelCase Converter · Title Case Converter · Sentence Case Converter · All case options
- Can it convert camelCase to snake_case?
- Yes. Paste the camelCase name and the words are split at each capital letter.
- Does it change capital letters?
- Yes. snake_case is all lowercase.
- What is snake_case used for?
- Variable and function names in Python, Ruby and Rust, database table and column names, and data keys, where words are joined with underscores.
- Is snake_case or kebab-case better for URLs?
- kebab-case. Google's URL structure guidance recommends hyphens, not underscores, to separate words in a web address.
- What happens to punctuation and extra spaces?
- Punctuation and repeated spaces are treated as word breaks, so hello world! becomes hello_world.
Questions
All converters: Uppercase to Lowercase · Lowercase to Uppercase · ALL CAPS Converter · ALL CAPS to Sentence Case · Capitalize Text · Title Case · Sentence Case · Toggle Case · Alternating Case · camelCase · PascalCase · kebab-case · CONSTANT_CASE & dot.case