Case Converter Guide: camelCase, snake_case, PascalCase & More
Technical Mastery Overview
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:
- Transform on the frontend:
response.userEmail = response.user_email - Use a library (camelcase-keys in Node, axios interceptor)
- Transform at the API gateway level
- 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:
camelCasefor JSON keys - Python/Django REST:
snake_casefor 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
camelcaserule and@typescript-eslint/naming-convention - Python: pylint's
naming-conventionor ruff's naming rules - CSS: stylelint with
selector-class-patternrule - SQL: sqlfluff with
aliasing.columnrules
Configure these in CI to reject non-conforming names at the code review stage rather than catching them in production logs or API contracts.
Experience it now.
Use the professional-grade Case Converter with zero latency and 100% privacy in your browser.