Skip to content
Utilities2026-06-175 min read

Online Case Converter: Switch Between camelCase, snake_case, PascalCase

What Is Case Conversion

Case conversion switches text between different naming conventions. In programming, different languages and contexts use different naming conventions — a case converter lets you switch between them instantly. Need to convert a string right now? Try our free Case Converter to switch between camelCase, snake_case, PascalCase, and more — instantly in your browser.

Common Naming Conventions

ConventionFormatExampleCommon Use
camelCaselowerCamelCasefirstNameJS variables, functions
PascalCaseUpperCamelCaseFirstNameReact components, classes
snake_caselower_snake_casefirst_namePython, database fields
kebab-caselower-kebab-casefirst-nameCSS classes, URL slugs
SCREAMING_SNAKE_CASEUPPER_SNAKE_CASEFIRST_NAMEConstants
Title CaseCapitalized WordsFirst NameHeadings, documents
flat/lowercasealllowercasefirstnameCSS atomic classes, tags

Why You Need Case Conversion

  1. Cross-language development: JS uses camelCase, Python uses snake_case — frequent conversion needed
  2. API integration: Backend returns snake_case fields; frontend needs camelCase
  3. CSS class names: Convert descriptive text to kebab-case
  4. Database migration: Different databases use different conventions
  5. Code refactoring: Rename variables across naming styles
  6. Constant definitions: Convert regular variable names to SCREAMING_SNAKE_CASE

How to Use an Online Case Converter

Using ToolVault's Case Converter:

  1. Paste text or an identifier in any style (no auto-detect step — you choose the target)
  2. Click the target button: UPPER / lower / Title / camelCase / PascalCase / snake_case / kebab-case / CONSTANT_CASE
  3. Copy from the live output panel

Identifier modes (camel / pascal / snake / kebab / constant):

  • Split on camelCase boundaries and separators, then greedily match common acronyms (HTTP, URL, JSON, ID, …) so XMLHttpRequest → xml_http_request
  • Map a–z / A–Z with a locale-independent ASCII table so Turkish i → İ never corrupts identifiers
  • Split on CJK ↔ Latin boundaries (用户Name → 用户_name) while keeping CJK segments intact

Naming Conventions by Language

JavaScript / TypeScript

// Variables, functions: camelCase
const firstName = "Alice";
function getUserData() {}

// Classes, components: PascalCase
class UserService {}
function UserProfile() {}

// Constants: SCREAMING_SNAKE_CASE
const API_BASE_URL = "https://api.example.com";

Python

# Variables, functions: snake_case
first_name = "Alice"
def get_user_data(): ...

# Classes: PascalCase
class UserService: ...

# Constants: SCREAMING_SNAKE_CASE
API_BASE_URL = "https://api.example.com"

CSS

/* Class names: kebab-case */
.user-profile { }
.primary-button { }

React

// Component files: PascalCase.tsx
// UserProfile.tsx
// index.tsx (exception: directory index)

// Components: PascalCase
function UserProfile() {}

// Variables, handlers: camelCase
const userName = "Alice";
const handleClick = () => {};

Conversion Rules Explained

camelCase → snake_case

// Insert underscore before uppercase, lowercase all; acronym lexicon for ALL-CAPS runs
firstName → first_name
getUserData → get_user_data
XMLHttpRequest → xml_http_request
getHTTPURL → get_http_url

snake_case → camelCase / PascalCase

first_name → firstName   // camel
first_name → FirstName   // pascal
get_user_data → getUserData

PascalCase → kebab-case

UserProfile → user-profile
XMLHttpRequest → xml-http-request

The Turkish-i problem and locale-aware conversion

toUpperCase("i") in Turkish is İ (dotted capital I), not I — and a case converter that ignores locale silently corrupts Turkish user data stored through it. The classic bug: an email normalization pipeline uppercases usernames; Turkish users get locked out because their i became İ. This tool's identifier modes use an ASCII a–z/A–Z map; prose UPPER/lower fix en-US so Latin results stay predictable. Beyond Turkish: German ß uppercases to SS (changing string length!), and Greek final sigma (ς vs σ). If your data crosses locales: preserve the original, convert only for display or matching, and never store the converted form as the identity.

Camel case splitting: where ambiguity lives

Converting getUserByIDString back to words is guesswork — is it "get User By ID String" or "Get User By Idstring"? Splitters differ on acronyms (consecutive capitals), digits (v2Parser), and leading underscores. This tool greedily matches known acronyms and leaves unknown ALL-CAPS runs intact — tools that pretend full determinism produce embarrassing exports. When reverse conversion matters, pick your forward convention to make it unambiguous: always capitalize acronyms consistently, never mix _ and case separators in one identifier.

For URL-friendly slugs that include Chinese, pair this with the slug generator for pinyin; keep the case converter for pure style switches.

Case conversion as a code-migration tool

The bulk use-case in practice: JSON APIs snake_case, JavaScript camelCase, and the 400-field mapping between them. Converters handle the mechanical part, but two field names map ambiguously (created_at_2 → createdAt2?) and one wrong field silently drops data. The professional pattern: convert, diff against a known-good sample object (deep-compare JSON), and add a type-level check (TypeScript satisfies or a Zod schema) so the next schema change fails loudly instead of shipping undefined fields.

Digits, acronyms, and when not to convert

Identifier modes also split on letter↔digit boundaries (v2Parser → v_2_parser in snake). That is intentional for HTTP2Client-style names, but noisy if you wanted v2_parser as a single token—edit after convert when the digit is part of a product codename. The acronym lexicon (longest-first) covers common runs such as HTTP, URL, JSON, CDN, SDK, CLI, and GUID; unknown ALL-CAPS chunks stay intact rather than being guessed apart.

Do not run prose paragraphs through camel/snake modes expecting pretty titles—use Title / UPPER / lower for human text. Do not store converted identifiers as primary keys when the original casing was the contract (database columns, public API fields). For URL slugs that need pinyin from Chinese, use the slug generator; keep this tool for pure style switches.

Implementer's note

Prose UPPER/lower/title use en-US locale casing (so German ß → SS in upper). Identifier modes use a fixed ASCII a–z map so a browser set to tr-TR cannot turn i into İ inside getUserId. That split is deliberate: human sentences follow locale expectations; code identifiers must stay byte-stable across machines.

FAQ

Why Does JavaScript Use camelCase While Python Uses snake_case?

Historical convention. JavaScript inherited camelCase from Java. Python's community established snake_case via PEP 8. Both have advantages — the key is consistency within a team.

When Should I Use SCREAMING_SNAKE_CASE?

For constants that shouldn't be modified. const API_URL = "..." with uppercase naming signals to developers this is a constant that shouldn't be reassigned.

kebab-case or snake_case?

CSS class names and URL slugs must use kebab-case (browsers and most routers treat hyphens as word breaks). Variable names follow language conventions.

PascalCase vs camelCase?

Only the first letter differs: userProfile vs UserProfile. Classes, React components, and type names use Pascal; variables and functions use camel. This tool switches both in one click.


This article is brought to you by ToolVault. Browse more online tools on the homepage.