Skip to main content
riqo.ioTools for big ideas

Software naming conventions: camelCase, PascalCase, snake_case and kebab-case

How to choose and apply consistent naming conventions across code, APIs, files, URLs and databases.

Concept and context

Naming conventions turn words into predictable identifiers through shared rules for capitalization, separators and acronyms.

They do not change domain meaning, but they reduce ambiguity and make code, APIs, files and schemas easier to scan.

A sound mental model separates the abstract concept from its concrete representation and from the environment in which it is used. That separation prevents assumptions that are valid for one protocol, library or format from being carried into systems whose rules or guarantees are different.

Fundamentals and terminology

camelCase starts lowercase and capitalizes following words; PascalCase capitalizes the first word too; snake_case uses underscores; kebab-case uses hyphens.

Platforms impose different constraints, so a hyphen fits URLs but is invalid in many language identifiers.

Terminology should be read together with the standard, version or contract that defines it, because similar words can describe different properties at different layers. Making those definitions explicit improves interoperability, documentation and the ability to diagnose unexpected behavior.

How it works

Reliable conversion first identifies word boundaries and only then applies the target convention.

Acronyms, digits, Unicode and mixed identifiers such as HTTPServer2ID make tokenization more important than blindly replacing separators.

In real systems it helps to follow data across layers and identify which transformations are reversible, which introduce constraints and where information can be lost. This makes responsibilities among producers, consumers, storage and transport easier to reason about and test.

Worked example

userProfileId, UserProfileId, user_profile_id and user-profile-id may represent one concept in JavaScript, class names, SQL and web routes.

A policy per layer is often better than forcing one convention onto ecosystems with different idioms.

A worked example becomes reusable when it exposes its preconditions and invariants rather than showing only an end result. Changing one assumption at a time helps distinguish behavior guaranteed by a standard from choices made by a particular application or implementation.

Errors and misconceptions

Changing letter case is not always equivalent to correctly renaming an identifier because word boundaries may be lost and some Unicode case mappings are language-sensitive.

Acronym handling also needs a consistent policy, for example URLValue versus UrlValue.

Many failures come from implicit assumptions between systems that look compatible while using different versions, canonicalization rules or type models. For interoperability and security, unusual inputs should therefore be specified and tested deliberately instead of being treated as irrelevant edge cases.

Best practices and selection criteria

Follow ecosystem conventions, document exceptions and define rules for acronyms, numbers and mappings between API and database names.

Automate linting where possible, but treat renaming public APIs or persistent columns as contract changes rather than cosmetic formatting.

Robust practice combines documented standards, mature libraries, explicit contracts and tests that include representative boundary cases. The best choice is not automatically the shortest or most popular one; portability, readability, performance, security, evolution and operating cost all matter.

Related guides

Unicode and UTF-8: code points, bytes and characters

How Unicode assigns code points and UTF-8 encodes them as bytes, with consequences for text, storage and interoperability.

Grapheme clusters, code points and bytes: what a “character” really means

Why one visible character may contain multiple code points and many bytes, and how to choose the right metric.

Related tools

Text case converter

Convert text to lower, UPPER, Title, snake_case, kebab-case or camelCase.

Open tool