ToolMint
text-tools5 min readMay 16, 2026

camelCase vs snake_case vs kebab-case: When to Use Each

Most software projects have a consistent naming convention for variables, functions, class names, and file names. The three most common formats are camelCase, snake_case, and kebab-case. Understanding where each is used prevents the visual inconsistency that makes code harder to read and review.

When to Use camelCase

camelCase writes the first word in lowercase and capitalizes the first letter of every subsequent word: myVariable, getUserData, handleButtonClick. It is the default convention for JavaScript variable names, function names, and object property keys. JSON uses camelCase for property names in most APIs. Java and C# method and variable names follow camelCase. TypeScript types and interfaces typically use PascalCase (same as camelCase but with the first letter also capitalized): UserProfile, ApiResponse.

When to Use snake_case

snake_case writes all words in lowercase joined by underscores: my_variable, user_id, get_user_data. It is the default convention in Python for variable names, function names, and module names. SQL column names and database table names conventionally use snake_case. PHP and Ruby variables also use snake_case. SCREAMING_SNAKE_CASE (all uppercase with underscores) is the convention for constants in many languages: MAX_RETRY_COUNT, API_BASE_URL.

When to Use kebab-case

kebab-case writes all words in lowercase joined by hyphens: my-component, button-primary, user-profile-card. It is the standard for CSS class names and custom property names. HTML attribute names, URL slugs, and file names for web assets use kebab-case. Many CLI tool flags and command names use it as well. It cannot be used for JavaScript variable names because the hyphen is interpreted as a minus operator.

Try the tools mentioned in this guide

Frequently Asked Questions

Is there a tool to convert text between these cases?
Yes. Paste any phrase into a text case converter and click camelCase, snake_case, or kebab-case to get the correctly formatted output instantly.
Which case should I use for file names?
For web projects, kebab-case is widely preferred for file names because it is URL-safe and readable. For Python packages and scripts, snake_case is the convention.

Related Guides