Convert4Me – Convert4Me home
Share

camelCase to snake_case Converter

Paste camelCase or PascalCase names and turn them into snake_case, such as userFirstName to user_first_name. Each line is converted separately.

Characters: 0Words: 0Lines: 0

Case types with examples

Starting text: The Lord of the Rings

  • snake_case

    Words are lowercase and joined with underscores.

    the_lord_of_the_rings

  • camelCase

    Words are joined with no spaces; every word after the first starts with a capital.

    theLordOfTheRings

  • PascalCase

    Words are joined with no spaces and every word starts with a capital.

    TheLordOfTheRings

  • kebab-case

    Words are lowercase and joined with hyphens.

    the-lord-of-the-rings

  • CONSTANT_CASE

    Words are capitals joined with underscores.

    THE_LORD_OF_THE_RINGS

camelCase and snake_case

camelCase joins words by capitalizing each new word (userFirstName). snake_case writes the words in lowercase and puts an underscore between them (user_first_name). The same name often has to move between the two: a JavaScript object property becomes a database column, a JSON field becomes a Python variable, or an API response is mapped to another language's conventions. This page converts a list of names in one step, one name per line.

How the conversion works

Each line is split into words at spaces, hyphens, underscores and at every boundary where a lowercase letter or number is followed by a capital letter. The words are then written in lowercase and joined with underscores. PascalCase names such as UserFirstName work the same way, and the other buttons give kebab-case, CONSTANT_CASE and the reverse direction.

Because only the lowercase-to-capital boundary is detected, a run of capitals stays in one word. XMLHttpRequest becomes xmlhttp_request and getHTTPResponse becomes get_httpresponse. If your names contain acronyms, fix those few by hand.

Which language uses which style

Python, Ruby and Rust conventionally use snake_case for variables and functions, and SQL column names are often snake_case too. JavaScript, Java and Swift prefer camelCase for variables and methods. When data crosses between these worlds, converting names mechanically avoids typing mistakes, but always check the result against your schema before you use it.

How to use the camelCase to snake_case tool

  1. Paste one name per line into the box, for example a list of variable or column names.
  2. Click snake_case.
  3. Click the copy icon above the text and use the result.

Frequently asked questions

How does camelCase become snake_case?

The converter splits a name wherever a lowercase letter or digit is followed by a capital, then joins the words in lowercase with underscores: userFirstName becomes user_first_name.

What happens to abbreviations like XMLHttpRequest?

Only the lowercase-to-capital boundary is split, so a run of capitals stays together: XMLHttpRequest becomes xmlhttp_request, not xml_http_request. Check names with acronyms by hand.

Can I convert a whole source file?

Paste the names, one per line. The tool converts names and phrases; it does not rename identifiers inside a program for you.

Your privacy comes first. Your text and numbers stay in your browser and we never see them. If you allow it, we save what you type on this device and use Google Analytics to count visits. We never sell your data. Privacy Policy