Switch text between camelCase,
snake_case, kebab-case, PascalCase and the rest.
Use it when names cross a boundary between conventions. For
example, a Python API sends created_at to a
JavaScript client that expects createdAt, or a SQL
schema becomes a model class. Paste a whole list and each line is
converted on its own.
user_first_name
getHTTPResponseCode
Order Shipped At
billing-address-line-2 userFirstName
getHttpResponseCode
orderShippedAt
billingAddressLine2 JavaScript and Java variables, JSON keys in most APIs, Swift properties.
Class names almost everywhere, React components, C# and Go exported identifiers.
Python and Ruby variables, SQL columns, Rails and Django database schemas.
Environment variables and compile-time constants, such as DATABASE_URL in a .env file.
CSS classes, URL slugs, HTML attributes, npm package names, CLI flags.
Config keys in Spring and Laravel, feature flags, translation keys.
The tool splits words on spaces, underscores, hyphens and dots,
and at the point where a lowercase letter or digit meets an
uppercase one. A run of capitals stays together as one word, so
getHTTPResponseCode comes apart as get / HTTP /
Response / Code instead of splitting every letter of HTTP.
Acronyms are treated as ordinary words. This
tool turns them into getHttpResponseCode, the form
Google's Java and JavaScript style guides recommend. If your
codebase keeps acronyms in capitals, fix those names by hand
after converting.
Each line is converted on its own, so you can paste a list of database columns, JSON keys or form fields and get the matching list back in the same order. Sentence case lowercases every word after the first, including names and acronyms, so check proper nouns in the result.
const words = (s) =>
s
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
.replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2")
.split(/[\s_\-.]+/)
.filter(Boolean);
const cap = (w) => w[0].toUpperCase() + w.slice(1).toLowerCase();
const camel = (s) => words(s).map((w, i) => (i ? cap(w) : w.toLowerCase())).join("");
const snake = (s) => words(s).map((w) => w.toLowerCase()).join("_");
const kebab = (s) => words(s).map((w) => w.toLowerCase()).join("-");
console.log(camel("get_HTTP_response")); // getHttpResponse
console.log(snake("getHTTPResponse")); // get_http_response
console.log(kebab("Order Shipped At")); // order-shipped-at The second replace stops getHTTPResponse from becoming get_h_t_t_p_response. It splits a run of capitals only before its last letter, which starts the next word.
<?php
function toWords(string $s): array {
$s = preg_replace('/([a-z0-9])([A-Z])/', '$1 $2', $s);
$s = preg_replace('/([A-Z]+)([A-Z][a-z])/', '$1 $2', $s);
return array_values(array_filter(preg_split('/[\s_\-.]+/', $s)));
}
function camel(string $s): string {
$w = toWords($s);
return strtolower(array_shift($w)) . implode('', array_map('ucfirst', array_map('strtolower', $w)));
}
function snake(string $s): string {
return implode('_', array_map('strtolower', toWords($s)));
}
echo camel('order_shipped_at'), PHP_EOL; // orderShippedAt
echo snake('orderShippedAt'), PHP_EOL; // order_shipped_at
// Laravel ships these: Str::camel(), Str::snake(), Str::kebab(), Str::studly() import re
def words(s: str) -> list[str]:
s = re.sub(r"([a-z0-9])([A-Z])", r"\1 \2", s)
s = re.sub(r"([A-Z]+)([A-Z][a-z])", r"\1 \2", s)
return [w for w in re.split(r"[\s_\-.]+", s) if w]
def camel(s: str) -> str:
parts = words(s)
return parts[0].lower() + "".join(w.capitalize() for w in parts[1:])
def snake(s: str) -> str:
return "_".join(w.lower() for w in words(s))
print(camel("order_shipped_at")) # orderShippedAt
print(snake("orderShippedAt")) # order_shipped_at
# Converting API keys on the way in and out of a dataclass is the
# most common real use for this. Case conversion usually happens at a boundary, such as a Python or Rails API sending snake_case keys to a JavaScript client that uses camelCase. We recommend converting in one place, the serializer, instead of at every call site. Laravel, Django REST Framework and most JSON libraries have a hook for this.
This tool follows the specifications below. Read them when you need the exact normative wording, for example to settle an edge case between two implementations.
Ten: camelCase, PascalCase, snake_case, CONSTANT_CASE (also called SCREAMING_SNAKE_CASE), kebab-case, dot.case, Title Case, Sentence case, UPPERCASE and lowercase.
It splits on spaces, underscores, hyphens and dots, and at the boundary where a lowercase letter or digit meets an uppercase one. A run of capitals stays together, so getHTTPResponse and get_http_response both come apart into the same three words.
Yes. Each line is converted on its own, so you can paste a list of database columns or JSON keys and copy the converted list back in the same order.
A digit stays attached to the letters before it, so address2 stays one word. A digit after a separator becomes its own word, so line-2 becomes line2 in camelCase. Punctuation that is not a separator stays where it is, which matters when the input is a sentence instead of an identifier.
No. It capitalizes every word. Editorial title case, as in AP or Chicago style, keeps short words like of and the in lowercase, and the rules differ between guides, so fix those words by hand.
For URLs, use the slug generator, which also strips accents and punctuation. If you are renaming keys inside a payload, the JSON formatter lays out the before and after one key per line, and the diff checker shows exactly what changed.