Skip to content
CaseConverterHQ

Snake case converter

Join words with underscores and drop everything to lowercase. Paste a phrase, a camelCase identifier or a whole column of spreadsheet headers and get valid snake_case back.

Change the case

Programmer cases

Lines and spacing

Paste some text and choose a conversion.

Words
0
Characters
0
No spaces
0
Sentences
0
Paragraphs
0
Lines
0
Read time
0 sec

Nothing you paste leaves your browser — every conversion runs on this page. Check this before you rely on it. This text converter is provided free and without warranty, and its results are not professional advice.

Where snake_case is the convention

Python's style guide, PEP 8, specifies snake_case for functions, variables and modules, and the standard library follows it closely enough that camelCase in Python code reads as foreign. Ruby uses it for methods and variables. Rust uses it for functions, variables and modules, and the compiler will warn you if you do not.

Outside programming languages it is the default in SQL. Column and table names are case-insensitive in most engines but case-folded inconsistently — PostgreSQL folds unquoted identifiers to lowercase, Oracle folds them to uppercase — so a camelCase column name means quoting it forever or accepting that userId and userid are the same thing. Underscores sidestep the whole problem.

The shouted variant, CONSTANT_CASE, is the convention for constants in most languages and for environment variables in essentially all of them. The button for it sits with the other programmer cases below.

Snake case versus kebab case

They look interchangeable and are not. An underscore is a valid identifier character in nearly every programming language; a hyphen is the subtraction operator, so user-name in most languages parses as "user minus name". That single fact decides which one you can use where.

So: underscores inside code — variables, columns, file names in Python and Ruby projects, environment variables. Hyphens outside it — URLs, CSS class names, HTML attributes, npm package names. Getting this backwards is the most common reason a name that looked fine in a spreadsheet fails to compile.

Worked examples

Run through the same code the button runs, so the examples cannot drift from the tool.

Inputsnake_case
User First Nameuser_first_name
getUserProfileget_user_profile
HTTP Response Codehttp_response_code
total (USD)total_usd

Common questions

How do I convert camelCase to snake_case?

Paste the identifier and click Convert to snake_case. Case boundaries are treated as word breaks, so getUserProfile becomes get_user_profile.

What is the difference between snake_case and SCREAMING_SNAKE_CASE?

Only capitalisation. snake_case is lowercase and used for variables and functions; SCREAMING_SNAKE_CASE, also called CONSTANT_CASE, is uppercase and used for constants and environment variables.

Can I use snake_case in a URL?

You can, but hyphens are the better choice. Search engines have long treated the hyphen as a word separator and the underscore as a joiner, and underscores can be hidden by the underline on a link.

Other text tools