Skip to main content
CaseSwitch

snake_case Converter

Use the CaseSwitch snake_case Converter to turn camelCase, PascalCase, or spaced labels into lowercase names joined by underscores (user_profile). Paste one name or a list, review the result, and copy it. Conversion runs in this browser — nothing is uploaded.

Written by the CaseSwitch editorial team. We maintain these tools in the browser so drafts, keys, and images stay on your device.

Last reviewed: 23 July 2026

Processed locally in your browser. Nothing is sent to a server.

Paste or type text to convert. Output stays empty until there is input.

Character count: 0 · Word count: 0 · Line count: 0

Examples

From camelCase

Input

userProfile

Output

user_profile

From a spaced label

Input

User Profile

Output

user_profile

From kebab-case

Input

get-user-id

Output

get_user_id

From PascalCase with acronym run

Input

HTTPResponse

Output

http_response

Already snake_case

Input

already_snake

Output

already_snake

How to use

  1. Paste a camelCase, PascalCase, kebab-case, or spaced label.
  2. Confirm underscores look right and that acronyms split the way your style guide wants.
  3. Copy the snake_case name. Uppercase the whole string only if you need a constant.

What this tool is for

snake_case is lowercase words joined by underscores: user_profile_id. Python, Ruby, and many Rust APIs use it for functions and variables; SQL columns and a large share of config keys use it because it stays readable and does not collide with CSS or subtraction. This converter exists so you can map a JavaScript-style field or a human label into that convention without rewriting fifty names by hand. It outputs lowercase snake_case only — uppercase the result yourself if you need a SCREAMING_SNAKE constant.

How it works

Word boundaries come from spaces, hyphens, underscores, and dots, and from camelCase / PascalCase shifts already in the input. Segments are lowercased and joined with a single underscore. Repeated separators collapse so you do not get user__id from messy input. Punctuation that is not a separator stays attached to the segment.

When to use it

Aligning a Node or TypeScript mapper with PostgreSQL column names, generating Python method names from a product spec, turning spreadsheet headers into database fields, and preparing keys that will later become environment-style constants (then uppercasing). Paste one identifier per line for bulk work.

When not to use it

JavaScript and TypeScript variables in modern React apps are usually camelCase; snake_case there looks like a Python leftover. Public URL paths should use kebab-case or the Slug Generator — hyphens are the conventional choice for readable URLs. Do not paste a whole source file. Do not change a public JSON contract to snake_case without a version bump.

How it compares to related tools

kebab-case is the URL and CSS cousin (hyphens instead of underscores). camelCase and PascalCase are the JavaScript cousins. The Slug Generator strips punctuation for public paths and always uses hyphens. SCREAMING_SNAKE_CASE is this output uppercased (MAX_RETRY). Longer background: What is camelCase? and Developer naming conventions.

Common mistakes

Converting a public JSON API to snake_case without versioning clients. Leaving a leading underscore that Python treats as “internal” when you did not mean that. Expecting HTTPResponse to stay as one token — this converter splits acronym runs and yields http_response. Using snake_case in a public URL when hyphens are the conventional choice for readable paths.

snake_case in SQL and Python

PostgreSQL folds unquoted identifiers to lowercase, so mixed-case column names force awkward quoting forever. snake_case avoids that. PEP 8 asks for snake_case on Python functions and variables; CapWords stay on classes. When you map a camelCase API into a Python service or a SQL table, convert the field list here, then generate migrations or serializers from the result.

Constants vs lowercase snake_case

This tool always lowercases. Module-level constants in Python and many configs use SCREAMING_SNAKE_CASE (MAX_RETRY_COUNT). Convert to snake_case first, then uppercase in your editor if that is the house style. Do not confuse that with environment variable names that also happen to use underscores — those are usually uppercase by convention, not because the database requires it.

Frequently asked questions

Does PostgreSQL require snake_case?+

It does not require it, but unquoted identifiers fold to lowercase, and mixed-case names become a quoting nightmare. snake_case is the practical default.

How is this different from the slug generator?+

Slugs use hyphens and strip characters for URLs. snake_case keeps underscores and is meant for code and databases.

Will HTTPResponse become http_response or httpresponse?+

http_response. The splitter breaks an acronym run when a capital is followed by a capital-then-lowercase pattern, then lowercases each segment.

Can I get SCREAMING_SNAKE_CASE?+

Convert here for the underscore layout, then uppercase the output in your editor. This page does not offer an uppercase mode.

Should JSON keys be snake_case?+

Some Python and Rails APIs use snake_case keys; many JavaScript APIs use camelCase. Match the existing API. Do not convert a public contract without a version bump.

Is my text uploaded?+

No. Conversion runs in this browser. You can disconnect after the page loads and still convert.

Does this tool send my payload to CaseSwitch?+

No. Formatting, encoding, and naming conversions for this page run in your browser after load — your sample stays on the device.

Related guides

Read our original articles on this topic.

Related tools

kebab-case Converter

CSS class names and BEM blocks, REST path segments, data-testid values, design-token names that a style guide wants dashed, and a first-pass convert from camelCase props into a URL-ish token. Paste one name per line for bulk work.

camelCase Converter

Migrating SQL columns to a Node API, turning spreadsheet headers into TypeScript property names, renaming CSS modules that a linter wants in camelCase, and converting a design-doc phrase into a variable name. Paste a list, one identifier per line, for bulk work, then review acronyms before you commit.

dot.case Converter

Building i18n keys, namespacing telemetry events, matching a config schema that already uses dotted paths, and turning spreadsheet headers into lodash-style accessor strings. Paste one identifier per line for bulk work, then shorten overly deep keys by hand.

PascalCase Converter

Naming React components and matching file names to their default export, generating TypeScript interfaces from a design-doc phrase list, turning SQL or API field labels into C# or Java class names, and converting a kebab-case or snake_case token into a type name. Paste one identifier per line for bulk work, then review acronyms before you commit.

Slug Generator

Blog posts, documentation pages, product listing URLs, knowledge-base articles, and CMS permalink fields when you have a working title and need a path before publish. Also useful for turning a noisy marketing headline into a short candidate slug you can still edit by hand.