Need to convert text to any format instantly?
Text Case ConverterQuick reference
| Format | Example | Primary uses |
|---|---|---|
| camelCase | getUserName | JS/TS variables, functions, JSON keys |
| PascalCase | GetUserName | Classes, React/Vue components, C# methods |
| snake_case | get_user_name | Python, Ruby, SQL, Rust variables |
| kebab-case | get-user-name | HTML, CSS, URLs, file names |
| CONSTANT_CASE | MAX_RETRY_COUNT | Constants, env variables, macros |
| Title Case | Get User Name | UI headings, article titles |
| dot.case | get.user.name | Config files, Java packages, i18n keys |
camelCase
camelCase writes compound words with no spaces. The first word is entirely lowercase; every subsequent word starts with a capital letter. The name comes from the hump-like appearance of the internal capitals.
Where it is used:
- JavaScript / TypeScript: variables, function names, object keys, method names —
let userName = 'Alice',function fetchData() {} - Java: field names, method names —
private String firstName; - Swift / Kotlin: variables, properties, functions
- JSON: key names in REST APIs (especially when consumed by JavaScript)
camelCase is banned in Python for variables (use snake_case) and in CSS class names (use kebab-case).
PascalCase
PascalCase (also called upper camel case or StudlyCase) capitalises every word including the first: HelloWorld, UserProfile, ApiResponse.
Where it is used:
- Classes in virtually every language:
class UserAccount {} - React components:
<UserCard />— React distinguishes native HTML elements from components by the first letter - Vue / Angular components: component definitions use PascalCase
- TypeScript interfaces and types:
interface ApiResponse {} - C# methods: unlike Java, C# uses PascalCase for all public methods
- Enum members in many languages
snake_case
snake_case uses only lowercase letters with underscores as word separators. It was popularised by C and Unix conventions and remains dominant in several modern languages.
Where it is used:
- Python: variables, function names, module names — mandated by PEP 8, the official Python style guide
- Ruby: same convention as Python
- SQL: table names and column names —
user_account,created_at - Rust: variables and functions
- Database ORMs: most ORMs (Django, SQLAlchemy, ActiveRecord) use snake_case for model attributes
- File names in Python projects:
user_service.py
snake_case is highly readable because the underscore acts as a clear, unambiguous word separator. It never creates ambiguity about where one word ends and the next begins — unlike camelCase with acronyms (parseHTMLString vs parseHtmlString).
kebab-case
kebab-case uses only lowercase letters with hyphens as word separators. The name refers to meat on a skewer. It cannot be used for programming identifiers in most languages because the hyphen is the subtraction operator — user-name would be parsed as user minus name.
Where it is used:
- CSS class names and IDs:
.btn-primary,#user-card— the de facto standard - HTML custom data attributes:
data-user-id="42" - URL slugs:
/blog/how-to-calculate-gpa/— hyphens signal word boundaries to search engines and are preferred by Google over underscores - File names in web projects:
user-profile.html,main-nav.css - CLI flags:
--output-format,--max-retries - npm package names:
react-dom,lodash-es
CONSTANT_CASE
CONSTANT_CASE (also called SCREAMING_SNAKE_CASE or UPPER_SNAKE_CASE) uses all uppercase letters with underscores. It visually signals that a value never changes.
Where it is used:
- Constants in JavaScript/TypeScript:
const MAX_RETRIES = 3; - Environment variables:
DATABASE_URL,API_KEY,NODE_ENV - Macros in C/C++:
#define BUFFER_SIZE 1024 - Enum values in Java and C#
dot.case
dot.case uses lowercase letters with dots as separators. It is not used in mainstream programming identifiers but appears in several specific contexts:
- Configuration files:
database.host,app.debugin YAML, TOML, and .properties files - Java package names:
com.example.utils - i18n translation keys:
auth.login.error.invalid_credentials - Logging namespaces in Node.js (debug library):
app:server:requestuses colons, but some tools use dots
Language-by-language cheatsheet
| Language | Variables / functions | Classes | Constants | Files |
|---|---|---|---|---|
| JavaScript | camelCase | PascalCase | CONSTANT_CASE | kebab-case |
| TypeScript | camelCase | PascalCase | CONSTANT_CASE | kebab-case |
| Python | snake_case | PascalCase | CONSTANT_CASE | snake_case |
| Java | camelCase | PascalCase | CONSTANT_CASE | PascalCase |
| C# | camelCase (private) / PascalCase (public) | PascalCase | PascalCase | PascalCase |
| Ruby | snake_case | PascalCase | CONSTANT_CASE | snake_case |
| Rust | snake_case | PascalCase | CONSTANT_CASE | snake_case |
| CSS | kebab-case | — | — | kebab-case |
| SQL | snake_case | — | CONSTANT_CASE | — |
Frequently asked questions
Which case should I use for REST API endpoints?
kebab-case is recommended for URL paths: /api/user-accounts/. For JSON request and response bodies, camelCase is standard when the API is consumed by JavaScript. Python APIs (Django REST Framework, FastAPI) often return snake_case. Check what your frontend expects and be consistent.
Does Google prefer kebab-case or underscores in URLs?
Google officially treats hyphens in URLs as word separators. Underscores do not separate words — hello_world is treated as one word by Google. Use kebab-case for all URL slugs for better SEO.
Can I mix cases in one file?
Yes, and you often must. A JavaScript file routinely uses camelCase for variables, PascalCase for classes, CONSTANT_CASE for constants, and kebab-case for CSS class names in JSX. The key is using each convention for its intended purpose consistently.
What is Title Case vs Sentence case?
In Title Case, every word starts with a capital letter: "The Quick Brown Fox". In Sentence case, only the first word and proper nouns are capitalised: "The quick brown fox". Title Case is standard for English headings and article titles; Sentence case is preferred for UI labels and button text in most style guides.
Convert your text to any case format instantly.
Open Text Case ConverterRelated tools
- Word Counter — count words, characters, and sentences
- URL Encoder / Decoder — encode and decode URL strings
- Code Formatter — format JSON, XML, YAML instantly