Naming Style Converter
Convert among camel / Pascal / snake / kebab / CONSTANT styles in one click
Naming-style conversion: the five styles and the traps in between
The five styles
| Style | Example | Commonly used for |
|---|---|---|
| camelCase | userLoginCount | JS / Java variable and method names |
| PascalCase | UserLoginCount | C# / Java / TypeScript type names |
| snake_case | user_login_count | Python / Ruby identifiers, database column names |
| kebab-case | user-login-count | URLs, CSS class names, HTML attributes, file names |
| CONSTANT_CASE | USER_LOGIN_COUNT | The convention for constants |
The tool's process is: first split the input into words, then rejoin them in the target style. So the key to understanding conversion behavior is the word-splitting rule, not the joining.
The word-splitting rule and its boundaries
To split correctly you must first find the word boundaries. The tool uses three rules:
| Rule | Example | Result |
|---|---|---|
| Lowercase or digit followed by uppercase breaks here | userLogin | user / login |
| Consecutive uppercase then "uppercase + lowercase" breaks before the last uppercase | HTTPResponse | http / response |
| Any non-alphanumeric character is a separator | user-login_count | user / login / count |
The second rule exists specifically for abbreviations. Without it, HTTPResponse would split into h / t / t / p / response, which is plainly wrong. A naive implementation that "breaks before every uppercase letter" ruins every name containing an abbreviation — the most common conversion bug.
Yet even with this rule, some cases are unsolvable:
userIDsplits into user / id (correct), butuserIDsmay split into user / i / ds (because IDs is "uppercase + uppercase + lowercase"). An abbreviation plus a plural cannot be solved perfectly by rules.- A single all-upper word cannot tell abbreviation from ordinary word.
IDandURLbecomeidandurlin camelCase (by convention), but whetherOKtookorIOtoiois appropriate is debatable. - A lowercase string with no separators cannot be split.
userloginis treated as a single word; the tool will not (and should not) guess a boundary in the middle.
So conversion is not bidirectionally reversible: userID to USER_ID to userId differs from the original after the round trip. To preserve fidelity, confirm the original style before converting and check the result.
Practical traps during conversion
- An abbreviation's case cannot be recovered from other styles. Both
http_responseandHTTP_responsebecomeHttpResponsein PascalCase, losing the fact that "HTTP is an abbreviation". You needHTTPResponseonly by hand. - The position of digits. For
utf8Encodeorbase64Encode, how the digit-letter boundary affects splitting differs between tools and may yield eitherutf_8_encodeorutf8_encode. Check after converting. - kebab-case cannot be an identifier. In some languages it is a minus expression, and in JSON keys it needs quotes. It suits URLs and CSS, not variable names.
- Database columns and code fields often use different styles. A common need is converting
user_login_count(database) touserLoginCount(a field in code). In batch, do not convert something already camelCase again (idempotent, harmless), but when converting kebab to snake the hyphen is swallowed, so confirm no extra separator remains. - Case-sensitive languages. In Go an initial uppercase means exported (public) and lowercase means private. Converting to PascalCase changes visibility, which may be what you want or may be a compile error.
How to use the tool
Enter an identifier in any style and the tool gives all five styles at once; copy the line you need. Spaces, hyphens, underscores, and dots in the input are all recognized as word boundaries.
It suits deciding the target style when renaming a variable, converting a backend's snake_case field to the frontend's camelCase, and generating a JS identifier from a CSS class name. Conversion runs locally in your browser.
FAQ
How are words split?
First split by separators like underscores, hyphens and spaces, then handle camelCase boundaries (e.g. getUserInfo into user / get / info), unify to lowercase and recombine.
Does it support Chinese identifiers?
No. Naming style conversion targets ASCII alphanumeric identifiers; Chinese is treated as a non-word character and ignored.