snake_case Converter

Convert camel, space, or kebab text to lowercase_snake_case

Convert any phrase, camelCase, PascalCase, or kebab-case string into snake_case. Lowercases each word and joins them with underscores — the standard naming convention for Python variables, functions, and SQL columns. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is snake_case?

snake_case writes a compound name in all lowercase with underscores between words, like user_profile_id. It is the standard convention for variable and function names in Python and for column names in SQL databases.

snake_case is the conventional naming style for Python identifiers and SQL columns: all lowercase, with underscores between words. This converter rewrites any phrase or differently-cased identifier into clean snake_case.

How it works

The input is normalised into a list of lowercase word tokens, then joined with underscores. Word boundaries come from separators and from case transitions in camelCase or PascalCase input:

"User Profile Id" -> user_profile_id
"userProfileId"   -> user_profile_id
"user-profile-id" -> user_profile_id
"HTTPServer"      -> http_server

Each detected word is lowercased before joining, so the result is always a valid, lowercase, underscore-separated identifier.

Tips and notes

Acronyms are lowercased, so parseHTML becomes parse_html. Letters and digits are split during tokenisation; if you want v2 to stay together, rejoin it after copying. The output is safe to use directly as a Python variable name or SQL column, provided it does not begin with a digit.


When to use snake_case

Different communities have different naming conventions, and knowing which convention to apply where avoids code review friction:

ContextConventionExample
Python variables and functionssnake_caseuser_profile_id
Python modules and packagessnake_casedata_utils.py
SQL column namessnake_casecreated_at
SQL table namessnake_case or SCREAMING_SNAKEuser_accounts
JavaScript/TypeScript variablescamelCaseuserProfileId
CSS class nameskebab-caseuser-profile-id
URL slugskebab-case/user-profile
Constants (Python, many languages)SCREAMING_SNAKE_CASEMAX_RETRY_COUNT

How the converter handles different inputs

The converter detects word boundaries from multiple source formats in a single pass:

From natural language phrases — Spaces split the phrase into words, each word is lowercased, underscores join them.

"User Profile ID" → user_profile_id

From camelCase — Each transition from a lowercase letter to an uppercase letter is a word boundary.

"userProfileId" → user_profile_id

From PascalCase — Same as camelCase but the first word also starts with uppercase.

"UserProfileId" → user_profile_id

From kebab-case — Hyphens are treated as word separators and removed.

"user-profile-id" → user_profile_id

From SCREAMING_SNAKE_CASE — Underscores are already separators; everything is lowercased.

"USER_PROFILE_ID" → user_profile_id

Acronym handling

Consecutive uppercase letters (acronyms) are treated as a single word:

"HTTPSServer"  → https_server
"parseHTML"    → parse_html
"parseHTMLDoc" → parse_html_doc

This matches Python’s PEP 8 recommendation: treat acronyms as single lowercase words (html_parser, not h_t_m_l_parser).

Practical workflow: renaming database columns

If you are migrating a database schema from a framework that used camelCase column names (common in JavaScript ORMs) to a PostgreSQL-native convention:

  1. List the column names from your ORM or schema file
  2. Paste each name into this converter
  3. Copy the snake_case output
  4. Use it in your migration script

For example, a migration converting createdAt, updatedAt, and userId produces created_at, updated_at, and user_id — the standard PostgreSQL column style.