userID goes into snake_case as user_id and comes back out of camelCase as userId. No error appears anywhere. The two names differ by one capital letter, and every lookup that relied on the old spelling now misses.
A naming convention can only store what its separators and capitals express. snake_case cannot record that ID was written in capitals. camelCase cannot record that an underscore stood before a digit. Anything the target convention cannot express is dropped, and converting back cannot restore it. The case converter finds word boundaries by fixed rules, so you can predict which names will change.
Test a name before you rename it
Paste the original name into the case converter and copy the target convention with that card's Copy button. Then paste the result back into the field and compare the card for the original convention with the name you started with. The conversion runs in your browser and nothing is uploaded, so names from an internal schema stay on your machine.
| Original | Via | Converted | Converted back | Same? |
|---|---|---|---|---|
user_name |
camelCase | userName |
user_name |
Yes |
MAX_RETRIES |
camelCase | maxRetries |
MAX_RETRIES |
Yes |
userID |
snake_case | user_id |
userId |
No |
parseHTTPResponse |
snake_case | parse_http_response |
parseHttpResponse |
No |
address_line_2 |
camelCase | addressLine2 |
address_line2 |
No |
_private |
camelCase | private |
private |
No |
get_x_y |
camelCase | getXY |
get_xy |
No |
a_b |
PascalCase | AB |
ab |
No |
v2beta |
CONSTANT_CASE | V2BETA |
v2_beta |
No |
straße_name |
CONSTANT_CASE | STRASSE_NAME |
strasse_name |
No |
These are the common reasons a name changes on the round trip:
- an acronym written in capitals, such as
IDorHTTP - a digit right after a separator, such as
line_2 - a digit followed by a letter, such as
v2beta, when the trip goes through CONSTANT_CASE - an apostrophe
- a separator at the start or end of the name, or two separators in a row (
_private,__init__,a__b) - two one-letter words in a row: after the first word in camelCase (
get_x_y), anywhere in PascalCase (a_b) - a letter whose upper case is longer, such as
ß, when the trip goes through CONSTANT_CASE
How the converter decides where a word ends
For camelCase, PascalCase, snake_case, kebab-case and CONSTANT_CASE, the text is first split into words by three rules:
- A new word starts where a lowercase letter or a digit is followed by a capital letter.
- When a run of capitals ends in a capital followed by a lowercase letter, the split goes before that last capital, so
HTTPResponsebecomesHTTP+Response. - Any run of characters that are not letters or digits is a separator, and separators are dropped.
Then the words are joined. camelCase lowercases the first word and capitalizes the rest. PascalCase capitalizes every word. Capitalizing means the first letter goes to upper case and the rest to lower case. snake_case and kebab-case lowercase every word and join them with _ or -. CONSTANT_CASE uppercases every word and joins them with _.
Hello World-Example
→ helloWorldExample
→ hello_world_example
→ HELLO_WORLD_EXAMPLE
Rule 3 explains the separator rows in the table. A run of underscores counts as one separator, and a separator at the start or end has no word on one side, so _private loses its underscore and a__b becomes a_b.
Rules 1 and 2 explain get_x_y. Rule 1 splits get from XY, and rule 2 only splits a run of capitals before a capital followed by a lowercase letter, so XY stays one word. The same happens to AB in PascalCase.
Rule 1 also explains v2beta. In lower case, nothing splits 2 from beta. In CONSTANT_CASE the B is a capital after a digit, so the way back finds a new word there.
Letters from any script count as word characters, so zażółć gęślą becomes zażółćGęślą in camelCase.
Mapping API keys that contain ID or HTTP
Every word is lowercased before it is capitalized, so acronyms are normalized. The From camelCase example, parseHTTPResponse handler, gives parseHttpResponseHandler in camelCase. On the way back from user_id, the tool produces userId, because nothing in user_id shows that id was ever in capitals.
This matches a published convention. The Google Java Style Guide lowercases each word before capitalizing it, so "XML HTTP request" becomes XmlHttpRequest and "new customer ID" becomes newCustomerId. PEP 8 takes the other side: in CapWords, acronyms keep all their capitals, so HTTPServerError is better than HttpServerError. If your codebase follows PEP 8, you have to restore the acronym capitals by hand in converted PascalCase (CapWords) names, such as class names.
Keys that contain a number
Digits count as word characters, but they have no case. Capitalizing 2 leaves 2, so in camelCase nothing marks where the previous word ends:
address_line_2 → addressLine2 → address_line2
On the way back, a letter followed by a digit does not start a new word. Line2 is read as one word, and the underscore is gone. A digit followed by a capital letter does start a new word, so the result also depends on what comes after the number:
v_2_beta → v2Beta → v2_beta
The boundary after the 2 survives, but the one before it does not. Before you rely on an automatic mapping, check every key that has a separator next to a number, such as line_2, oauth_2 or v_2.
Pasting several keys at once
In the programmer cases, a line break is a separator like any other, so the camelCase card shows ten pasted keys as one long identifier. Only the five programmer cases (camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE) merge lines. UPPERCASE, lowercase, Title Case and Sentence case keep the lines as they are.
The same rule drops dots, slashes, hyphens, underscores and spaces, and it splits words at apostrophes: it's becomes it_s in snake_case and itS in camelCase. Input made only of separators, such as --- ___, gives an empty result.
To rename many names across a file, use find and replace with a regular expression instead. When a pattern starts catching the wrong things, see why a regex matches too much, too little or nothing.
Turning an identifier into a heading or a slug
Title Case and Sentence case lowercase the whole text first. In Title Case, API becomes Api and TEST becomes Test. In Sentence case they become api and test unless they start a sentence. The Unicode case mapping FAQ notes that case mapping is lossy: the original capitals cannot be recovered from the result. Title Case keeps apostrophes inside words and has no list of small words, so it's a TEST becomes It's A Test.
Sentence case capitalizes the start of the text, plus the first letter after ., ! or ? when a space or a line break follows the mark. Abbreviations are not recognized, so see e.g. the docs becomes See e.g. The docs.
kebab-case keeps diacritics: zażółć gęślą becomes zażółć-gęślą. For a URL slug that replaces accented letters with plain ones, use the slug generator.
Letters that change length in upper case
The tool uses the browser's built-in toUpperCase and toLowerCase, which the ECMAScript specification defines as locale-insensitive Unicode mappings (see section 3.13 of the Unicode Standard). ß becomes SS, so the text gets longer, and the change only goes one way. straße_name in CONSTANT_CASE is STRASSE_NAME, and converting that back to snake_case gives strasse_name. The Turkish dotted and dotless i get no special handling, because they need language-specific rules.
FAQ
Is it safe to convert a name that is already in the target convention?
Usually, but not always. snake_case and kebab-case output stays the same when you apply the same case again. camelCase and PascalCase output with two one-letter words in a row changes on a second pass: getXY becomes getXy, and AB becomes Ab. CONSTANT_CASE output where a digit is followed by a letter also changes: V2BETA becomes V2_BETA. Hand-written names can change too: in snake_case, __init__ becomes init, so check acronyms and leading underscores even when you keep the same convention.
Which convention should a new name use?
Follow your language's style guide. PEP 8, for example, uses snake_case for functions and variables, CapWords (PascalCase) for classes, and capitals with underscores for constants. Settle on how acronyms are written as well, because the guides disagree on that.