Home โบ Case Converter for Developers
Case Converter for Developers
How the conversion works
Each line is first split into words. Word boundaries are detected at spaces, underscores, hyphens, dots and slashes, at a change from a lowercase letter or digit to an uppercase letter (user|Id), and at the end of an acronym followed by a capitalized word (HTTP|Response). The words are then lower-cased and re-joined in the target style. Because of this, any style can be converted to any other: getHTTPResponseCode โ get_http_response_code โ getHttpResponseCode.
Naming conventions by language
| Style | Example | Typical use |
|---|---|---|
| camelCase | maxRetryCount | JavaScript/TypeScript, Java and C# variables and methods, JSON keys |
| PascalCase | MaxRetryCount | Classes and types in most languages, C# methods, Go exported names |
| snake_case | max_retry_count | Python, Ruby, Rust variables and functions, SQL column names |
| CONSTANT_CASE | MAX_RETRY_COUNT | Constants and environment variables |
| kebab-case | max-retry-count | URLs, CSS classes, HTML attributes, CLI flags, npm package names |
| dot.case | max.retry.count | Config keys (Spring, Java properties), i18n message keys |
Gotchas
- Lossy round-trips: converting
userIDto snake_case and back givesuserId, because the information that "ID" was an acronym is lost. - Numbers stay attached to the preceding word (
base64Encodeโbase64_encode), which matches how most codebases write them. - Non-ASCII letters such as
รฉorรare kept, but many languages do not allow them in identifiers.
Frequently asked questions
What is the difference between camelCase and PascalCase?
Both join words without separators and capitalize each word, but camelCase starts with a lowercase letter (userId, getHttpResponse) while PascalCase also capitalizes the first word (UserId, HttpResponse). In most languages camelCase is used for variables and functions and PascalCase for classes and types.
Which naming convention should I use in JSON APIs?
There is no single standard. JavaScript and Google APIs mostly use camelCase, while Python, Ruby and many REST APIs (GitHub, Stripe) use snake_case. Pick one per API and stay consistent; most serializers can convert automatically.
How are acronyms like HTTP or ID handled?
The converter treats a run of capitals as one word, so XMLHttpRequest becomes xml_http_request and userID becomes user_id. When converting back to camelCase, acronyms are written like normal words (xmlHttpRequest), which is what most style guides including Google's recommend.