>_

kebab-case to camelCase

kebab-case is common for URLs, CSS classes and properties, HTML attributes and CLI flags; camelCase is used for JavaScript / TypeScript / Java variables and JSON keys in many web APIs. Moving data between languages, databases and APIs often means converting between the two.

Examples

kebab-case camelCase
background-color backgroundColor
font-size fontSize
user-profile-card userProfileCard
max-width maxWidth
data-test-id dataTestId

Try it

camelCase
 
PascalCase
 
snake_case
 
CONSTANT_CASE
 
kebab-case
 
Train-Case
 
dot.case
 
path/case
 
Title Case
 
Sentence case
 
lowercase
 
UPPERCASE
 

In code

JavaScript

const toCamel = (s) => s.replace(/-([a-z\d])/g, (_, c) => c.toUpperCase());

Python

def to_camel(s: str) -> str:
    first, *rest = s.split('-')
    return first + ''.join(w.capitalize() for w in rest)

More examples

Open the full Case Converter →