Content & Writing

Free Online Case Converter

Switch between snake_case, camelCase, PascalCase, and more instantly.

Loading Utility…

Case Converter Guide · 8 min read

Case Converter Guide: camelCase, snake_case, PascalCase & More

Naming conventions are the silent contract between your code and its readers. Our Case Converter transforms text between camelCase, snake_case, PascalCase, kebab-case, SCREAMING_SNAKE_CASE, and other formats instantly — with batch conversion support.

Why Naming Conventions Matter

Naming conventions exist because different communities, languages, and systems developed independently and adopted different standards. When you integrate a Python backend (snake_case) with a JavaScript frontend (camelCase) consuming a REST API, inconsistent naming becomes a source of silent bugs, extra transformation code, and cognitive overhead.

Understanding which format to use where — and being able to convert between them quickly — is a daily skill for developers working across stack boundaries.

The Core Formats

camelCase

First word lowercase, subsequent words capitalized, no separators:

userEmailAddress
getAccessToken
parseJsonResponse
totalItemCount

Used in: JavaScript variables and functions, TypeScript, Java variables, Swift, Go

const userEmailAddress = 'alice@example.com';
function getAccessToken(userId) { ... }

PascalCase (UpperCamelCase)

Every word capitalized, no separators:

UserEmailAddress
GetAccessToken
ParseJsonResponse
TotalItemCount

Used in: JavaScript/TypeScript class names and React components, C# types and methods, Java class names, Python class names

class UserEmailAddress { ... }
const MyComponent: React.FC = () => { ... }

snake_case

All lowercase, words separated by underscores:

user_email_address
get_access_token
parse_json_response
total_item_count

Used in: Python variables and functions, Ruby, SQL column names, Rust, C

user_email_address = 'alice@example.com'
def get_access_token(user_id): ...

SCREAMING_SNAKE_CASE (UPPER_SNAKE_CASE)

All uppercase, words separated by underscores:

USER_EMAIL_ADDRESS
ACCESS_TOKEN_SECRET
DATABASE_CONNECTION_URL
MAX_RETRY_COUNT

Used in: Environment variables (universally), Python constants, C preprocessor macros, Java constants

# .env file
DATABASE_URL=postgres://...
JWT_SECRET=your-secret-here
MAX_CONNECTIONS=100

kebab-case

All lowercase, words separated by hyphens:

user-email-address
get-access-token
parse-json-response
total-item-count

Used in: CSS class names and IDs, HTML attributes, URL slugs, npm package names, Lisp

<div class="user-email-address" data-item-count="5"></div>
.user-email-address { color: #333; }

Train-Case (HTTP-Header-Case)

First letter of each word capitalized, hyphen separated:

User-Email-Address
Content-Type
X-Request-Id
Authorization

Used in: HTTP headers (universally)

Content-Type: application/json
X-Request-ID: 550e8400-e29b-41d4-a716-446655440000

Naming Convention by Language/Context

Context Convention Example
JavaScript variables camelCase userEmail
JavaScript classes PascalCase UserProfile
JavaScript constants SCREAMING_SNAKE MAX_RETRIES
TypeScript interfaces PascalCase UserProfile
CSS classes kebab-case user-profile
HTML attributes kebab-case data-user-id
Python variables snake_case user_email
Python classes PascalCase UserProfile
Python constants SCREAMING_SNAKE MAX_RETRIES
SQL columns snake_case user_email
Environment vars SCREAMING_SNAKE DATABASE_URL
HTTP headers Train-Case Content-Type
URL slugs kebab-case /user-profile
npm packages kebab-case react-query
Go exported PascalCase UserProfile
Go unexported camelCase userProfile
Rust variables snake_case user_email
Rust types PascalCase UserProfile

Cross-Language Integration Scenarios

Python API → JavaScript frontend

A Python REST API returns snake_case JSON:

{
  "user_email": "alice@example.com",
  "first_name": "Alice",
  "last_name": "Smith",
  "created_at": "2025-01-10"
}

JavaScript convention expects camelCase. Options:

  1. Transform on the frontend: response.userEmail = response.user_email
  2. Use a library (camelcase-keys in Node, axios interceptor)
  3. Transform at the API gateway level
  4. Use our converter to batch-convert field names during API design/documentation

Database columns → TypeScript interfaces

SQL columns use snake_case; TypeScript properties use camelCase:

-- Database
CREATE TABLE users (
    user_id UUID,
    email_address TEXT,
    created_at TIMESTAMP
);
// TypeScript interface
interface User {
    userId: string;
    emailAddress: string;
    createdAt: Date;
}

Use our converter to quickly generate TypeScript interface property names from SQL column names when building ORM models or API response types.

Environment variables to code

# .env (SCREAMING_SNAKE_CASE)
DATABASE_CONNECTION_STRING=postgres://...
STRIPE_SECRET_KEY=sk_live_...
# Python code (snake_case)
database_connection_string = os.environ['DATABASE_CONNECTION_STRING']
stripe_secret_key = os.environ['STRIPE_SECRET_KEY']
// JavaScript code (camelCase)
const databaseConnectionString = process.env.DATABASE_CONNECTION_STRING;
const stripeSecretKey = process.env.STRIPE_SECRET_KEY;

JSON Key Naming in API Design

REST API design guides have varying conventions:

  • Google API Style Guide: camelCase for JSON keys
  • Python/Django REST: snake_case for JSON keys
  • Rails: snake_case
  • OpenAPI/Swagger: no mandate, but examples use camelCase

The most important rule: be consistent within your API. A mix of user_id and userId in the same response is worse than either convention alone.

Use our JSON Formatter to inspect API responses, then our Case Converter to batch-transform key names when normalizing schemas. Validate the transformed data with our JSON Schema Validator to confirm the new format matches your contract.

Enforcing Conventions with Linters

Manual conversion is for one-time migrations. For ongoing enforcement:

  • JavaScript/TypeScript: ESLint with camelcase rule and @typescript-eslint/naming-convention
  • Python: pylint's naming-convention or ruff's naming rules
  • CSS: stylelint with selector-class-pattern rule
  • SQL: sqlfluff with aliasing.column rules

Configure these in CI to reject non-conforming names at the code review stage rather than catching them in production logs or API contracts.

Consistent naming conventions aren't aesthetic preferences — they're readability infrastructure. Convert systematically when integrating across language boundaries, and enforce conventions in code reviews and linters.

Frequently Asked Questions

Everything you need to know about the Case Converter and how your data is handled.

What is the difference between camelCase, PascalCase, and snake_case?
camelCase starts lowercase with each subsequent word capitalized: myVariableName. PascalCase (also called UpperCamelCase) capitalizes every word including the first: MyClassName. snake_case uses underscores between words in lowercase: my_variable_name. Each is preferred by different languages and contexts: camelCase in JavaScript, PascalCase for React components and C# classes, snake_case in Python and Ruby.
When should I use kebab-case vs. snake_case?
Use kebab-case (my-variable-name) for CSS class names, HTML attributes, URL slugs, and CLI flag names — contexts where hyphens are conventional and spaces are not allowed. Use snake_case (my_variable_name) for Python variables and functions, Ruby methods, SQL column names, and environment variables (in lowercase). SCREAMING_SNAKE_CASE is the standard for constants and environment variables across most languages.
Can the case converter handle multi-word phrases and sentences?
Yes. The converter correctly identifies word boundaries from spaces, hyphens, underscores, and existing camelCase boundaries, then applies the target format. Pasting "user account settings" and converting to PascalCase gives "UserAccountSettings"; "getHttpResponse" converted to snake_case gives "get_http_response". Common abbreviations and acronyms may need manual review depending on your convention.
Does the converter work with non-English characters?
The converter handles ASCII characters reliably. Unicode letters are generally passed through correctly for lowercase and uppercase conversions, but word boundary detection based on hyphens, underscores, and camelCase works best with ASCII identifiers. For heavily accented or CJK text, test the output carefully as word segmentation may not match your expectations.

Common Use Cases

  • Code Refactoring
  • Data Normalization
  • Naming Consistency

Related Tools