myVariableName, my_variable_name, MyVariableName, my-variable-name... are the same idea written in different naming conventions. Each language and context prefers one, and mixing them is a classic source of bugs and messy code. This guide explains them and tells you when to use each.
The most common naming conventions
camelCase
First word lowercase, the following ones with an initial capital, no separators: myImportantVariable. It's the standard for variables and functions in JavaScript, Java and C#.
PascalCase (UpperCamelCase)
Like camelCase but all words start with a capital: MyImportantVariable. Used for classes, components and types in almost every language (React, C#, TypeScript).
snake_case
All lowercase, words separated by underscore: my_important_variable. Standard in Python, Ruby and SQL column names.
SCREAMING_SNAKE_CASE
snake_case in uppercase: MY_IMPORTANT_VARIABLE. Reserved for constants in almost every language.
kebab-case
Lowercase separated by hyphens: my-important-variable. Used in URLs, file names, CSS classes and HTML attributes (underscores aren't allowed in some of these contexts).
When to use each
| Convention | Typical use |
|---|---|
camelCase |
Variables and functions (JS, Java) |
PascalCase |
Classes, components, types |
snake_case |
Variables in Python, SQL columns |
SCREAMING_SNAKE_CASE |
Constants |
kebab-case |
URLs, files, CSS classes |
The golden rule: be consistent. Follow the convention of the language and project you work in. Code that mixes styles is hard to read and maintain.
Other useful case changes
Beyond programming conventions, you often need:
- UPPERCASE or lowercase for all the text.
- Title Case (first letter of each word capitalized).
- Sentence case (only the first letter).
- iNVERT uppercase and lowercase.
Converting between all these by hand is tedious and error-prone. You can do it instantly with the text case converter on this site.
Why consistency matters
- Readability: the brain recognizes patterns; a uniform style reads faster.
- Fewer bugs: in case-sensitive languages,
myVarandmyvarare different variables. - Tooling: linters and formatters expect a convention; mixing them generates warnings.
- Collaboration: a team following the same convention produces coherent code.
Frequently asked questions
camelCase or snake_case? It depends on the language: JavaScript uses camelCase, Python uses snake_case. Follow your stack's convention.
Why do CSS classes use kebab-case? Because underscores and capitals cause compatibility issues, and the hyphen is the standard in CSS.
Can I convert a long text at once? Yes, a good converter transforms whole paragraphs between formats.
Is my data uploaded? No, if you use a local tool. Everything happens in your browser.
Convert text between camelCase, snake_case, uppercase, lowercase and more with the free text case converter, 100% in your browser.