Text case refers to the capitalization pattern applied to text. Different contexts — programming languages, style guides, URLs, databases — use different conventions. Converting between them manually is tedious and error-prone. Here's a complete reference.
The case formats explained
UPPERCASE
All letters capitalized. Used for acronyms, emphasis, constants in some languages, and headings in certain design styles.
HELLO WORLD → HELLO WORLD
lowercase
All letters in lowercase. Used for CSS properties, HTML attributes, email addresses, and URLs.
Hello World → hello world
Title Case
The first letter of each word is capitalized. Used for book titles, article headlines, product names, and UI headings.
the quick brown fox → The Quick Brown Fox
Title case rules vary by style guide (see below).
Sentence case
Only the first letter of the first word is capitalized, as in a regular sentence. Used for UI labels, error messages, and descriptions.
the quick brown fox → The quick brown fox
camelCase
No spaces; each word after the first starts with a capital letter. Used in JavaScript, Java, and Swift for variable and function names.
hello world → helloWorld
PascalCase
Like camelCase but the first word is also capitalized. Used for class names, component names (React), and types in most languages.
hello world → HelloWorld
snake_case
Words separated by underscores, all lowercase. Used in Python, Ruby, Rust, and SQL for variable and function names.
hello world → hello_world
SCREAMING_SNAKE_CASE
snake_case but all uppercase. Used for constants in Python, environment variables, and configuration keys.
hello world → HELLO_WORLD
kebab-case
Words separated by hyphens, all lowercase. Used in URLs, CSS class names, HTML attributes, and file names.
hello world → hello-world
dot.case
Words separated by dots, all lowercase. Used in package names (npm, Java), configuration keys, and logging namespaces.
hello world → hello.world
Case conventions by programming language
| Language | Variables | Functions | Classes | Constants |
|---|---|---|---|---|
| JavaScript | camelCase | camelCase | PascalCase | SCREAMING_SNAKE |
| Python | snake_case | snake_case | PascalCase | SCREAMING_SNAKE |
| Java | camelCase | camelCase | PascalCase | SCREAMING_SNAKE |
| Go | camelCase | camelCase | PascalCase | PascalCase |
| Rust | snake_case | snake_case | PascalCase | SCREAMING_SNAKE |
| CSS | kebab-case | — | — | — |
| SQL | snake_case | snake_case | — | UPPERCASE |
| Ruby | snake_case | snake_case | PascalCase | SCREAMING_SNAKE |
Title case style guide differences
Different style guides have different rules for which words to capitalize in titles:
| Style | Capitalize | Don't capitalize |
|---|---|---|
| AP Style | All major words | Articles, prepositions under 4 letters, conjunctions |
| Chicago | All major words | Articles, coordinating conjunctions, prepositions |
| APA | First word, proper nouns | Most other words |
| MLA | All major words | Articles, short prepositions, conjunctions |
Example: "The Cat in the Hat" (Chicago) vs. "The Cat In the Hat" would differ across guides.
Converting case in JavaScript
If you need to convert case programmatically:
// To camelCase
const toCamel = s => s.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (_, c) => c.toUpperCase())
// To snake_case
const toSnake = s => s.replace(/\s+/g, '_').replace(/([A-Z])/g, '_$1').toLowerCase().replace(/^_/, '')
// To kebab-case
const toKebab = s => s.replace(/\s+/g, '-').replace(/([A-Z])/g, '-$1').toLowerCase().replace(/^-/, '')
// To PascalCase
const toPascal = s => s.replace(/(?:^|\s|_|-)(\w)/g, (_, c) => c.toUpperCase())
These handle simple cases. For production use, consider a library like change-case which handles edge cases (acronyms, numbers, Unicode).
How to convert text case free
- Go to Text Case Converter
- Paste your text into the input
- Click the target case button (UPPERCASE, camelCase, snake_case, etc.)
- Copy the converted result
All conversion happens instantly in your browser — no data is sent anywhere.