Text case styles explained
A guide to camelCase, PascalCase, snake_case, kebab-case, Title Case and Sentence case: where each convention is used and how to convert text between them fast.
What a case style is
A case style is a convention for capitalizing words and joining them together. Writers use case styles for headlines and interface text. Programmers use them to name variables, functions, files, database columns and URLs, where spaces are usually not allowed. Following the convention of your language or project makes text easier to scan and avoids bugs caused by names that do not match.
Code case styles
camelCase
Words are joined with no separator. The first word is lower case and every following word starts with a capital: userName, totalPrice, isLoggedIn. camelCase is the standard for variables and functions in JavaScript, TypeScript, Java and Swift, and is common for JSON keys in web APIs.
PascalCase
Like camelCase, but the first word is capitalized too: UserProfile, HttpClient. It is used for class and type names in most languages, for React components and for public members in C#. Our case converter does not have a separate PascalCase mode; convert to camelCase and capitalize the first letter.
snake_case
Words are lower case and joined with underscores: user_name, total_price. It is the convention for variables and functions in Python (PEP 8) and Ruby, and is very common for database tables and columns. An upper case variant, often called CONSTANT_CASE or SCREAMING_SNAKE_CASE, is used for constants and environment variables such as MAX_RETRIES or DATABASE_URL. To get it, convert to snake_case and then to UPPERCASE.
kebab-case
Words are lower case and joined with hyphens: user-profile, main-nav. It is used for URLs, CSS class names, HTML attributes, file names and command-line flags such as --dry-run. Most programming languages cannot use kebab-case for variable names, because the hyphen is read as a minus sign.
Writing case styles
Title Case
Major words are capitalized: The Quick Guide To Case Styles. Style guides disagree on the details. AP, Chicago and APA each have their own rules for short words like a, of, to and the, and for words after a hyphen. Title case is common for book titles, headlines and some navigation menus.
Sentence case
Only the first word and proper nouns are capitalized, as in a normal sentence: The quick guide to case styles. Many modern style guides and design systems prefer sentence case for headings, buttons and labels because it reads more naturally and avoids debates about which words to capitalize.
UPPERCASE and lowercase
All capitals draw attention but are slower to read in long passages and can feel like shouting in messages. Use them sparingly for short labels and acronyms. Lowercase is useful for normalizing data, such as email addresses before comparing them.
How to convert text between cases
- Open the case converter.
- Paste or type your text, or open a text file.
- Pick a mode: UPPERCASE, lowercase, Title Case, Sentence case, camelCase, snake_case or kebab-case.
- Copy the result or download it as a text file. The output updates as you edit.
What the converter does with tricky input
Knowing the exact rules helps you avoid surprises:
- Title Case capitalizes the first letter of every word, including short words like of and the. If your style guide keeps those lower case, fix them by hand afterwards.
- Title Case and Sentence case lowercase the rest of each word first, so acronyms like NASA become Nasa. Restore acronyms and proper nouns after converting.
- Sentence case capitalizes the first letter of the text, the first letter after a period, question mark or exclamation mark, and the first letter of each line.
- camelCase, snake_case and kebab-case split words at spaces, punctuation and existing case changes, so userName becomes user_name in snake_case.
- These code cases keep only the letters A to Z and digits. Accents are removed, so café becomes cafe, and letters from other alphabets are dropped.
- Title Case also capitalizes letters after hyphens, slashes and opening brackets, so well-known becomes Well-Known.
- Each line is converted separately, so you can convert a whole list of names at once.
Examples: one phrase in every style
Here is the phrase total order count written in each convention, as the converter produces it:
- UPPERCASE: TOTAL ORDER COUNT
- Title Case: Total Order Count
- Sentence case: Total order count
- camelCase: totalOrderCount
- snake_case: total_order_count
- kebab-case: total-order-count
- CONSTANT_CASE (snake_case, then UPPERCASE): TOTAL_ORDER_COUNT
Because the code cases detect existing word boundaries, you can also go from one code style to another. Paste totalOrderCount and choose snake_case to get total_order_count, or paste total-order-count and choose camelCase to get totalOrderCount. This is handy when you map database columns to API fields or rename CSS classes. Runs of capitals, as in HTTPServer, are not split, so check acronyms in the result.
Case styles for URLs
For web addresses, use lowercase kebab-case slugs: /guides/text-case-styles-explained. Hyphens are widely recommended as word separators in URLs, lower case avoids duplicate addresses on case-sensitive servers, and removing punctuation keeps links clean when shared. The slug generator converts titles to slugs, one per line, removes accents and lets you choose hyphens or underscores.
Choosing a convention for a project
- Follow the language's official style guide first, such as PEP 8 for Python.
- Match the existing codebase. Consistency matters more than personal preference.
- Pick one style for API fields and convert at the boundary if the front end and back end differ.
- Write the convention down in a contributing guide or linter configuration so everyone follows it.