use case
How to convert camelCase to snake_case
Convert JavaScript variable names to Python or SQL naming conventions.
JavaScript uses camelCase for variables and functions; Python and SQL use snake_case. When writing a backend that bridges both ecosystems — serialising a JavaScript object to a Python API, or mapping JSON keys to database column names — you need to convert dozens of identifiers at once. This guide shows how to convert any camelCase identifier to snake_case in one step, and how to automate the conversion in a script.
Step-by-step guide
- Paste the camelCase identifier: Enter the camelCase name — for example 'firstName', 'createdAt', or 'isEmailVerified'. The tool recognises camelCase word boundaries automatically.
- Select snake_case as the target: Choose 'snake_case' from the target case selector. The output will be all-lowercase with underscores between words.
- Use in Python or SQL: Copy the result and use it as a Python variable name, a database column name, or a key in a snake_case API payload. In Django or SQLAlchemy, snake_case field names map directly to database columns.
Frequently asked questions
- How do I convert an entire JSON object's keys from camelCase to snake_case?
- In Python, use a library like 'humps': import humps; humps.decamelize({'firstName': 'Jan'}). In Node.js, use 'snakecase-keys': const snakecaseKeys = require('snakecase-keys'); snakecaseKeys({ firstName: 'Jan' }). For a one-off check, convert each key with this tool.
- Is 'myID' converted to 'my_id' or 'my_i_d'?
- The tool treats a run of uppercase letters as a single word: 'myID' → tokens ['my', 'id'] → 'my_id'. If your input uses 'myId' (only the first letter capitalised), it also correctly produces 'my_id'.
Try it now
Use the Text Case Converter to complete this task — free, no sign-up, runs in your browser.
Open Text Case Converter →