Every programming community settled on its own way of squeezing several words into one identifier. None of them is objectively better, but mixing them inside one codebase is a reliable source of friction and bugs. Here's who uses what, where the conventions came from, and how to convert between them without tripping over acronyms.
The five main styles
| Name | Example |
|---|---|
| camelCase | userAccountId |
| PascalCase (UpperCamelCase) | UserAccountId |
| snake_case | user_account_id |
| SCREAMING_SNAKE_CASE (constant case) | USER_ACCOUNT_ID |
| kebab-case | user-account-id |
Why not just use spaces? Because almost every programming language uses whitespace to separate tokens, and many treat - as subtraction. That rules out kebab-case in most languages, which is why it lives mainly in URLs, CSS and file names.
Who uses what
| Language / context | Variables & functions | Types & classes | Constants |
|---|---|---|---|
| JavaScript / TypeScript | camelCase | PascalCase | SCREAMING_SNAKE or camelCase |
| Java, Kotlin | camelCase | PascalCase | SCREAMING_SNAKE |
| C# | camelCase (locals), PascalCase (methods, properties) | PascalCase | PascalCase |
| Python | snake_case | PascalCase | SCREAMING_SNAKE |
| Ruby | snake_case | PascalCase | SCREAMING_SNAKE |
| Rust | snake_case | PascalCase | SCREAMING_SNAKE |
| Go | camelCase (private) / PascalCase (exported) | PascalCase | Same as variables |
| PHP (PSR) | camelCase | PascalCase | SCREAMING_SNAKE |
| SQL | snake_case for tables and columns is the most common convention | ||
| CSS | kebab-case for classes and custom properties | ||
| URLs, file names, CLI flags | kebab-case | ||
| Environment variables | SCREAMING_SNAKE_CASE | ||
Go is the interesting one: capitalisation isn't just style there, it's semantics. A name starting with an uppercase letter is exported from its package; a lowercase one is private.
A little history
snake_case is old, common in C and Unix from the start (str_len-style names were everywhere) and later adopted by Python's PEP 8 and Ruby. camelCase took hold through Smalltalk and Pascal-family languages, then spread to the mainstream with Java in the mid-1990s, which JavaScript copied. kebab-case comes from Lisp, where hyphens in names were normal, and from the web, where URLs and CSS needed something readable that wasn't a space.
Which is more readable?
There's some eye-tracking research comparing the two. A 2010 study by Sharif and Maletic found participants recognised underscore-separated identifiers somewhat faster, while earlier work found experienced camelCase users caught up with practice. The honest conclusion is that familiarity wins. Follow the convention of the language and codebase you're in; consistency matters far more than the choice itself.
The hard part: acronyms
How do you write "HTTP request ID" in camelCase? Three common answers:
httpRequestId: treat acronyms as ordinary words. Recommended by Google's Java and JavaScript style guides and by Microsoft's .NET guidelines for acronyms longer than two letters.HTTPRequestID: keep acronyms uppercase. Go's style (ServeHTTP,userID) and older Apple APIs.XMLHttpRequest: a famous inconsistency, with one acronym upper and one not, frozen into the web platform forever.
The first style is the easiest to convert reliably, because word boundaries stay visible. With HTTPRequestID, a converter has to guess that "HTTPR" splits as HTTP + R…, which it can only do by noticing where an uppercase run is followed by a lowercase letter.
Converting between conventions
Conversion comes up constantly at boundaries: a Python API returning created_at to a JavaScript client that wants createdAt, a database column becoming a Go struct field, a config key becoming an environment variable. Some advice:
- Convert at the boundary, once.Most serialisation libraries can do it automatically (for example Jackson's naming strategies, Pydantic aliases, or a
camelcase-keysstep in JavaScript). Don't scatter manual renames through the code. - Watch out for digits. Is
address2in snake_caseaddress2oraddress_2? Pick one and be consistent, or round-trips will break. - Test round-trips.
user_id → userId → user_idshould be lossless. With acronyms and digits, it often isn't.
For one-off conversions, paste the identifier into our Text Case Converter. It splits on underscores, hyphens, spaces and camelCase humps, treats runs of capitals as acronyms (XMLHttpRequest → xml_http_request), and shows every style at once.