🔡Developer

Text Case Conventions in Programming: camelCase, snake_case, and kebab-case

Why does naming convention matter, which languages use which style, and how to convert between them without thinking too hard about it.

4 min readFebruary 27, 2026By FreeToolKit TeamFree to read

The first thing a code reviewer notices is naming consistency. A codebase mixing firstName, first_name, and FirstName for the same concept type is harder to read and signals inconsistent practices. Conventions exist to eliminate the question 'how should I name this?'

The Conventions at a Glance

  • camelCase: JavaScript/TypeScript variables and functions, JSON keys, Java/Swift properties
  • PascalCase: Class names everywhere, React components, TypeScript types/interfaces
  • snake_case: Python variables/functions, SQL columns, Ruby, configuration files
  • SCREAMING_SNAKE_CASE: Constants in most languages (MAX_RETRIES, API_KEY)
  • kebab-case: CSS classes, HTML attributes, URL paths, CLI flags

Why It Matters for APIs

APIs often cross language boundaries: a Python backend (snake_case) serves data consumed by a JavaScript frontend (camelCase). The common solution: serialize JSON with camelCase keys regardless of internal backend convention, and have the frontend convert if needed. Inconsistent API naming forces consumers to guess whether the property is userId, user_id, or UserId.

Converting Between Cases

Pasting content between systems with different conventions is common. Our Text Case Converter handles all the standard transformations without the manual work.

File and Folder Names

Web URLs are case-sensitive on most servers — /Blog/Post and /blog/post are different URLs. CSS files, HTML pages, and URLs should use kebab-case. JavaScript/TypeScript modules: kebab-case for file names (user-service.ts) matches the npm convention and avoids case sensitivity issues across Mac (case-insensitive filesystem) and Linux (case-sensitive) environments.

Linter enforcement

ESLint's camelcase rule and Prettier enforce naming in JavaScript. For Python, pylint and flake8 enforce PEP 8 conventions. Setting these up in a new project prevents convention drift and eliminates style arguments in code reviews.

Frequently Asked Questions

What is camelCase?+
camelCase writes compound words with each word after the first capitalized: firstName, getUserById, calculateTotalPrice. It's called camelCase because the capital letters look like camel humps. Used by: JavaScript variables and functions, Java variables and methods, Swift properties and methods. The 'lower camelCase' variety starts lowercase; PascalCase (also called UpperCamelCase) capitalizes the first word too and is used for class names in most languages.
What is snake_case?+
snake_case uses underscores between words, all lowercase: first_name, get_user_by_id, calculate_total_price. The underscores sit low like a snake. Used by: Python (PEP 8 convention for variables and functions), SQL column names, Ruby, C standard library, shell scripts, and database fields generally. Screaming snake case (SCREAMING_SNAKE_CASE or ALL_CAPS_WITH_UNDERSCORES) is used for constants in Python, Java, and most languages.
What is kebab-case?+
kebab-case uses hyphens between words, all lowercase: first-name, get-user-by-id, calculate-total-price. The hyphens look like the skewer through a kebab. Used by: HTML attributes (data-user-id), CSS class names and properties (background-color, .button-primary), URL slugs (/blog/my-post-title), and command-line flags (--output-file). Can't be used for JavaScript variable names because hyphens are interpreted as minus signs.
Does naming convention affect code performance?+
No, the interpreter or compiler treats identifiers the same regardless of their casing convention. The impact is entirely on readability, maintainability, and consistency. Studies on code readability do find that consistent naming within a codebase reduces cognitive load and speeds up code review. The specific convention matters less than applying it consistently — a codebase mixing camelCase and snake_case for the same types of identifiers is harder to read than one that consistently uses either.

🔧 Free Tools Used in This Guide

FT

FreeToolKit Team

FreeToolKit Team

We build free browser-based tools and write practical guides that skip the fluff.

Tags:

developernamingconventionsprogramming