IT Market
Tools/Text/Text Case/camelCase to snake_case Converter Online
camelCase → snake_case

Конвертер стилей именования переменных

Tool guide

camelCase to snake_case Converter Online

Snake_case is the Python convention from PEP 8 and the natural shape for PostgreSQL and MySQL columns, where unquoted identifiers fold to lower case anyway. When a front end sends keys like createdAt, the back end needs created_at instead. This converter rewrites a whole list at once by splitting on capital letters, and it runs in the page, so table and field names stay with you. See also: the same list as kebab-case for CSS, swap underscores for hyphens, force everything to lowercase.

How to use it

  1. Paste the keys or variable names into the camelCase field, one per line.
  2. Press convert — an underscore is inserted before each capital and the letter is lower-cased.
  3. Review the snake_case output before it goes into a migration; acronyms and all-caps names deserve a second look.
  4. Copy the list into a Python model, a CREATE TABLE statement or an API response mapping.
  5. If the same names are also needed for CSS or URLs, run the original list through the kebab-case converter.

FAQ

Why is snake_case the Python convention?

PEP 8 says so: functions, variables and attributes use lower case words joined by underscores, while CamelCase is reserved for class names. Mixing styles is not an error, but linters such as flake8 and ruff will flag it and the code stops looking familiar to the next reader.

How do I map API JSON keys onto model fields?

List the response keys one per line, convert them here and use the output as attribute names. In pydantic or a DRF serializer, declare the original spelling as an alias so the public contract keeps camelCase while your code keeps snake_case. Both sides keep their own convention.

What happens to names like userID?

An underscore is inserted before every capital, so userID becomes user_i_d rather than user_id. Fix those by hand, or normalise the acronym to userId before converting. Any purely mechanical case splitter has this limitation.

Do PostgreSQL columns really need snake_case?

Not strictly, but it saves pain. Unquoted identifiers fold to lower case, so a column created as orderTotal ends up as ordertotal and loses its word boundaries. order_total looks the same in every query and never needs quoting.

What happens to names that are already snake_case?

A line with no capitals passes through untouched — there is nothing to split, and existing underscores are preserved. That means you can paste a mixed list without sorting out which names have already been converted.

How do I get SCREAMING_SNAKE_CASE for constants?

The output here is lower case, so upper-case it in a second step with an uppercase text converter. Python constants and .env variables use that form: MAX_RETRY_COUNT rather than max_retry_count.

Examples

API keys mapped to a Python model
Before: createdAt updatedAt isEmailConfirmed
After: created_at updated_at is_email_confirmed
Columns for a CREATE TABLE statement
Before: orderTotalAmount customerPhone
After: order_total_amount customer_phone — no quoting needed in PostgreSQL