This converter turns camelCase or PascalCase identifiers into snake_case — the naming style used in Python, Ruby, Rust and SQL column names. Paste a name like myVariableName and get my_variable_name instantly. It is built for developers porting variable names between languages, renaming database columns, or normalising config keys, and it runs entirely in your browser.
How it works
The tool finds the word boundaries inside the identifier, lowercases each word, and joins them with underscores. It inserts a split in two places: between a lowercase or digit followed by an uppercase letter (a → B), and between a run of capitals and a following capitalised word, so acronyms stay intact. It then also splits on any non-alphanumeric separator. Each resulting word is lowercased and the pieces are joined with _.
Conversion examples
| Input | Words detected | Output |
|---|---|---|
myVariableName | my · variable · name | my_variable_name |
MyClassName | my · class · name | my_class_name |
parseHTMLString | parse · html · string | parse_html_string |
getUserID2 | get · user · id2 | get_user_id2 |
isActive | is · active | is_active |
APIResponseCode | api · response · code | api_response_code |
So parseHTMLString becomes parse_html_string, with the HTML acronym handled correctly rather than split letter by letter.
When you need this
Porting Python from JavaScript — JavaScript conventionally uses camelCase for variables and methods; Python uses snake_case everywhere. When you copy a function signature across, every argument name and local variable needs converting.
Writing database migrations — Many ORM frameworks in Python (SQLAlchemy, Django) store column names as snake_case. Renaming a column from a camelCase JavaScript model to match database convention is a frequent need.
Normalising config keys — Config files in YAML or TOML often expect snake_case keys, but code generators or JSON exports produce camelCase. Pasting the whole key list and converting saves error-prone manual renaming.
Rust identifier style — Rust’s compiler enforces snake_case for variables and function names and will warn on camelCase. Converting function names copied from a camelCase codebase stops those linter warnings before you commit.
Common pitfalls
- Double underscores — If the input has multiple consecutive non-alphanumeric characters (e.g.
my__var), they collapse to a single_in the output. - Leading or trailing separators — A name starting or ending with an underscore after conversion is usually a sign the input had an unusual prefix or suffix; check the result before pasting.
- Numbers — Digits are treated as part of the preceding word unless a non-alphanumeric character separates them, so
userId1becomesuser_id1, notuser_id_1.
Everything runs in your browser, so your code never leaves your machine.