When to use camelCase
camelCase produces identifiers that can be used directly in JavaScript. For example, background-color becomes backgroundColor in JavaScript style APIs.
Naming convention guide
camelCase removes separators and marks word boundaries with capitals, while kebab-case keeps words lowercase and joins them with hyphens. They often appear at different layers of the same web project.
| Difference | camelCase | kebab-case |
|---|---|---|
| Example | backgroundColor | background-color |
| Common use | JavaScript identifiers, object properties, DOM style properties, and application code | URLs, slugs, CSS-oriented names, file names, configuration, and CLI-friendly text |
| Word separator | None | Hyphen (-) |
| Capitalization | Internal words capitalized | Usually all lowercase |
| JavaScript identifier | Yes | Not unquoted |
| Typical web boundary | Application code | URL/CSS/text name |
camelCase produces identifiers that can be used directly in JavaScript. For example, background-color becomes backgroundColor in JavaScript style APIs.
kebab-case makes boundaries explicit with hyphens and works well in URLs, slugs, file names, CSS-oriented contexts, and text configuration.
| Context | Recommended convention | Why |
|---|---|---|
| JavaScript identifiers and object properties | camelCase | Hyphens are not valid in unquoted JavaScript identifiers, while camelCase can be used directly. |
| URLs, slugs, and many filenames | kebab-case | Hyphens make word boundaries readable without case sensitivity and are common in web-facing names. |
| CSS property names versus JavaScript style access | kebab-case in CSS, camelCase in JavaScript | CSS uses dashed property names, while DOM and React style APIs expose corresponding camelCase names. |
| Custom element names | Hyphenated name | Custom-element names require a hyphen, so a kebab-like spelling matches the platform constraint. |
Use camelCase for JavaScript-style identifiers and kebab-case where a hyphenated external name is expected. Convert at the boundary instead of forcing one style everywhere.
Paste an identifier below to see the target format and every supported developer naming style. Conversion runs locally in your browser.
user-profile-image-url
userProfileImageUrlUserProfileImageUrluser_profile_image_urluser-profile-image-urlUSER_PROFILE_IMAGE_URLuser.profile.image.urluser/profile/image/urlConversion happens locally in your browser. Your input is not sent to a conversion server.