LocalFirstTools.com — data tools that never leave your device
No upload — everything runs on your device

Convert text to snake_case

snake_case lowercases everything and joins words with underscores, detecting camelCase humps on the way in: userAccountId becomes user_account_id, and spaces and hyphens become underscores too. Type below and read the snake_case row — the CONSTANT_CASE row gives you the all-caps variant for free.

The conversion is driven by one regular expression boundary: a lowercase letter or digit followed by an uppercase letter ([a-z0-9] then [A-Z]) marks a word split, which is why userAccountId gains exactly two underscores. On the 244 unique keys in our sample corpus, 67 are multi-word — snake_case makes each of those boundaries cost one visible character, averaging 7.5 characters per key versus camelCase's 7.2.

camelCase
userAccountId
PascalCase
UserAccountId
snake_case
user_account_id
kebab-case
user-account-id
CONSTANT_CASE
USER_ACCOUNT_ID

When it goes wrong

All-caps acronym runs do not split — APIKey becomes apikey, not api_key — because no algorithm can find that boundary without a dictionary; write “API key” with a space to force it. If SQL is your destination and a converted name collides with a reserved word (order, user, group are classics), quote it or prefix it rather than trusting case conventions to save you.

When to use this

snake_case is the convention for Python, Ruby, Rust, SQL column names and many REST payloads — use it when moving identifiers from JavaScript into schemas or API contracts.

This page is a focused view of theCase Converter, which has the full set of options.

Frequently asked questions

What is SCREAMING_SNAKE_CASE for?

The all-caps variant (CONSTANT_CASE row in this tool) conventionally marks constants and environment variables: MAX_RETRIES, DATABASE_URL.

Why snake_case for SQL columns?

SQL identifiers are case-insensitive by default in most databases (PostgreSQL folds unquoted names to lowercase), so word separation by capitals is lost — underscores survive.