UPPERCASE, lowercase and Title Case — plus camelCase, snake_case and kebab-case naming. Handy whenever you write code or name variables.
| Case | Example | Typical use |
|---|---|---|
| UPPER CASE | USER_ID | Constants, acronyms, env variable names |
| lower case | user_id | Database columns, Unix file names |
| Title Case | User Id | Headings, article titles |
| Sentence case | User id | Sentences, UI labels |
| camelCase | userId | Java, JavaScript, Swift properties |
| PascalCase | UserId | Class and type names, React components |
| snake_case | user_id | Python, Ruby, SQL |
| kebab-case | user-id | URLs, CSS class names, HTML attributes |
Consistency matters more than which convention you pick. A codebase that mixes user_id and userId is harder to search than one that commits to either.
Proper title casing is not "capitalise every word". Most style guides — Chicago, APA, and the major newspapers — keep short articles, conjunctions and prepositions lowercase unless they start or end the title:
Because guides disagree about longer prepositions ("through", "between"), a converter can only apply one rule set. Expect to hand-tune titles that matter.
Conversion is mechanical until the input contains a run of capitals. getHTTPResponse should become get_http_response, but naive converters emit get_h_t_t_p_response, and userID becomes user_i_d instead of user_id. The rule that produces the right answer: treat a run of capitals as a single word, and split before the final capital when a lowercase letter follows it.
| Input | Correct | Naive result |
|---|---|---|
getHTTPResponse | get_http_response | get_h_t_t_p_response |
userID | user_id | user_i_d |
parseURLParams | parse_url_params | parse_u_r_l_params |
OAuth2Token | oauth2_token | o_auth2_token |
Languages also disagree about how an acronym should appear in the first place, so a name that is idiomatic in one stack looks wrong in another:
| Context | Convention | Example |
|---|---|---|
| Go | Acronyms stay fully uppercase | HTTPServer, userID |
| Java, .NET | Only the first letter capitalised | HttpServer, UserId |
| Python, Ruby, SQL | Lowercased inside snake_case | http_server, user_id |