Copied!
Back
Text Tool

String Case Converter — camelCase, snake_case, kebab-case & More

Convert text between camelCase, snake_case, kebab-case, PascalCase, UPPER_SNAKE_CASE, Title Case, dot.case, path/case, Sentence case, and more programming naming conventions. Smart word splitting detects camelCase boundaries, underscores, hyphens, dots, slashes, and spaces — then re-joins in your target format. Bulk-convert variable lists for refactoring across languages and ecosystems. All processing in your browser.

Last updated: April 2026
case-converter.tool
0 chars 0 words

What is a "case" and why do programming languages care?

"Case" in programming refers to the letter casing convention used for compound identifiers — variable names, function names, file names, URL paths. The same conceptual identifier ("user profile picture") can be written as userProfilePicture, user_profile_picture, user-profile-picture, UserProfilePicture, or USER_PROFILE_PICTURE depending on the convention. Each convention emerged from specific language constraints and community preferences over decades, and most modern style guides treat consistency as a hard requirement.

Why this matters: a 2026 developer touches multiple ecosystems daily. JavaScript wants camelCase, Python wants snake_case, CSS wants kebab-case, environment variables want SCREAMING_SNAKE. Refactoring a feature across all those layers means converting hundreds of identifiers. This converter automates the splitting + rejoining step so you can paste any input format and get any output format.

The 10 case conventions you'll actually meet

NameExampleUsed by
camelCaseuserProfilePictureJavaScript, Java, C# methods/fields, Swift
PascalCase (UpperCamelCase)UserProfilePictureClass names in JS/Java/C#/Python; type names; .NET conventions
snake_caseuser_profile_picturePython, Ruby, Rust, PHP variables, SQL identifiers, file names
SCREAMING_SNAKE_CASE (UPPER_SNAKE)USER_PROFILE_PICTUREConstants, environment variables, enum values
kebab-case (dash-case)user-profile-pictureCSS classes, URLs/slugs, HTML attributes, command-line flags
Title CaseUser Profile PictureHeadings, button labels, marketing copy
Sentence caseUser profile pictureDescriptions, paragraph copy, modern UI labels (Apple HIG, Material 3)
dot.caseuser.profile.picturei18n message keys, Java property files, configuration paths
path/caseuser/profile/pictureFile paths, URL paths, namespace separators
flatcaseuserprofilepictureOld DNS/legacy systems; rare in modern code

Which case for which language? — Style guide reference

Each ecosystem has authoritative style guides. Following them isn't optional — linters enforce them automatically in 2026.

LanguageVariables / functionsClasses / typesConstantsAuthoritative source
JavaScript / TypeScriptcamelCasePascalCaseSCREAMING_SNAKEAirbnb, Google JS Style
Pythonsnake_casePascalCaseSCREAMING_SNAKEPEP 8
Rubysnake_casePascalCaseSCREAMING_SNAKERubocop / Ruby style guide
Rustsnake_casePascalCaseSCREAMING_SNAKERust style guidelines
JavacamelCasePascalCaseSCREAMING_SNAKEOracle, Google Java Style
C# / .NETcamelCase (private), PascalCase (public)PascalCasePascalCase (.NET runtime), SCREAMING_SNAKE (older)Microsoft .NET conventions
GocamelCase (private), PascalCase (exported)PascalCasePascalCase or camelCasegofmt + Effective Go
PHPcamelCase (PSR-12)PascalCaseSCREAMING_SNAKEPSR-12
SwiftcamelCasePascalCasecamelCase (modern), SCREAMING_SNAKE (legacy)Apple Swift API Design Guidelines
SQLsnake_case (PostgreSQL convention)snake_caseSCREAMING_SNAKESQL style guide (no official)
HTML / CSSkebab-casekebab-casekebab-caseW3C, BEM (CSS naming)
URLs / slugskebab-casekebab-casekebab-caseGoogle URL structure guidelines
Env vars / shellSCREAMING_SNAKESCREAMING_SNAKEPOSIX

How smart word splitting works

The hard part of case conversion isn't joining words — it's finding the words inside an existing identifier. This converter uses a multi-pass tokenizer:

algorithm
Input: "userProfileXMLParser-v2"

Step 1: Split on non-alphanumeric (-, _, ., /, space)
        → ["userProfileXMLParser", "v2"]

Step 2: Split camelCase boundaries (lower → Upper transition)
        → ["user", "Profile", "XMLParser", "v2"]

Step 3: Split runs of UPPER followed by lowercase (acronym + word)
        → ["user", "Profile", "XML", "Parser", "v2"]

Step 4: Split letter-digit transitions (optional)
        → ["user", "Profile", "XML", "Parser", "v", "2"]

Step 5: Lowercase all
        → ["user", "profile", "xml", "parser", "v", "2"]

Step 6: Rejoin per target format
        camelCase → "userProfileXmlParserV2"
        snake_case → "user_profile_xml_parser_v_2"
        kebab-case → "user-profile-xml-parser-v-2"
        SCREAMING_SNAKE → "USER_PROFILE_XML_PARSER_V_2"

The tricky cases:

  • AcronymsXMLParser should split into XML + Parser, not X + M + L + Parser. Look for runs of uppercase followed by a lowercase letter.
  • Abbreviated identifiersuserIDs can be ambiguous: user + I + Ds? user + IDs? Most converters pick the latter, but it depends on heuristics.
  • Numbers — should user2profile split into user2 + profile or user + 2 + profile? Ask the converter what your style guide expects.
  • Multiple separatorsmy_var-name.field needs all three separators handled in one pass.

Case conversion in 8 programming languages

JavaScript / TypeScript (lodash, change-case)

javascript
// lodash (most popular)
import { camelCase, snakeCase, kebabCase, startCase } from 'lodash';
camelCase('user_profile_picture');     // 'userProfilePicture'
snakeCase('userProfilePicture');       // 'user_profile_picture'
kebabCase('UserProfilePicture');       // 'user-profile-picture'

// change-case (more granular control)
import { pascalCase, dotCase, pathCase } from 'change-case';
pascalCase('user-profile');            // 'UserProfile'
dotCase('userProfile');                // 'user.profile'

Python (built-in / inflection / stringcase)

python
import re

def camel_to_snake(name: str) -> str:
    s = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
    return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s).lower()

camel_to_snake('userProfileXMLParser')  # 'user_profile_xml_parser'

# Or use 'inflection' lib
import inflection
inflection.underscore('UserProfile')      # 'user_profile'
inflection.camelize('user_profile')       # 'UserProfile'
inflection.dasherize('user_profile')      # 'user-profile'

Ruby (built-in)

ruby
# ActiveSupport (Rails)
"user_profile".camelize           # "UserProfile"
"UserProfile".underscore          # "user_profile"
"UserProfile".dasherize           # "user-profile"
"user_profile".titleize           # "User Profile"

# Plain Ruby
'user_profile'.split('_').map(&:capitalize).join  # 'UserProfile'

Go (strings + custom)

go
import (
    "strings"
    "unicode"
)

func ToSnake(s string) string {
    var out strings.Builder
    for i, r := range s {
        if unicode.IsUpper(r) && i > 0 {
            out.WriteRune('_')
        }
        out.WriteRune(unicode.ToLower(r))
    }
    return out.String()
}

ToSnake("UserProfile")  // "user_profile"

// Or use github.com/iancoleman/strcase for full coverage

Rust (heck crate)

rust
use heck::{ToSnakeCase, ToKebabCase, ToPascalCase, ToShoutySnakeCase};

"UserProfile".to_snake_case();        // "user_profile"
"user_profile".to_pascal_case();      // "UserProfile"
"UserProfile".to_kebab_case();        // "user-profile"
"user_profile".to_shouty_snake_case(); // "USER_PROFILE"

PHP (str_*** functions / Symfony)

php
// Symfony String component
use Symfony\Component\String\u;

u('user_profile')->camel()->toString();    // 'userProfile'
u('userProfile')->snake()->toString();     // 'user_profile'
u('user_profile')->title()->toString();    // 'User_Profile'

// Laravel's Str helper
Str::camel('user_profile');                 // 'userProfile'
Str::snake('UserProfile');                  // 'user_profile'
Str::kebab('UserProfile');                  // 'user-profile'

Java (Apache Commons + Guava)

java
import com.google.common.base.CaseFormat;

CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "user_profile");
// → "userProfile"
CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, "UserProfile");
// → "user-profile"

// Or Apache Commons WordUtils for title case
import org.apache.commons.text.WordUtils;
WordUtils.capitalize("user profile");  // "User Profile"

Bash / shell

bash
# snake_case → kebab-case
echo "user_profile" | tr '_' '-'

# Lowercase / uppercase
echo "User Profile" | tr '[:upper:]' '[:lower:]'   # "user profile"
echo "user_profile" | tr '[:lower:]' '[:upper:]'   # "USER_PROFILE"

# camelCase → snake_case (sed)
echo "userProfileXMLParser" | sed -E 's/([A-Z]+)/_\1/g; s/^_//' | tr '[:upper:]' '[:lower:]'
# 'user_profile_x_m_l_parser' (naive — won't handle acronyms)

Common case conversion mistakes

  • Mixing conventions in one file. A JS file with both userProfile and user_profile means refactor inconsistency. Run a linter (ESLint, Prettier) that enforces the convention.
  • Ignoring acronym rules. Microsoft's .NET style: acronyms ≤ 2 chars stay uppercase (IO); ≥ 3 chars use camelCase (Xml, not XML). Different ecosystems disagree — pick a rule per project.
  • Naïve case conversion losing acronyms. HTTPServer → naïve snake_case → h_t_t_p_server. Smart converters preserve acronyms: http_server.
  • Inconsistent file vs identifier naming. user_profile.js exporting UserProfile works but is confusing. Most ecosystems pick file naming based on the export type (PascalCase for class files in React/.NET, snake_case for module files in Python/Rust).
  • Reserved words after conversion. class_nameclassName is fine, but my_classmyClass and back to my_class may collide with reserved words in some destinations.
  • i18n key drift. Translation keys like user.profile.title shouldn't change case casually — every translation file references them.
  • URL slugs in mixed case. /MyProfile vs /myprofile are different URLs to most servers. Use kebab-case (/my-profile) and lowercase consistently.
  • Conversion losing visible whitespace. "User profile picture" (sentence) and "user profile picture" (lowercase) are different — converting between them changes meaning in titles vs body.

Best case converter for 2026 — what to compare

Search results for "case converter online", "camelcase to snake_case", and "string case converter" return many tools but most fail on real-world identifiers: they don't handle acronyms (`XMLHttpRequest` should split as `xml http request`, not `xmlhttp request`), they break on already-cased input, or they don't surface all 6+ common cases simultaneously. Here is how the most-used case converters compare in 2026:

ToolAcronym handlingCases supportedBrowser-onlyCost
FreeDevTool Case ConverterSmart split (XMLHttpRequest → xml http request)camel, Pascal, snake, kebab, UPPER_SNAKE, Title, dot, pathYesFree
convertcase.netLimitedUPPER, lower, Title, SentenceYesFree, ad-funded
caseconverter.comLimitedUPPER, lower, Title, Sentence, alternatingYesFree, ad-heavy
npm change-caseFull (configurable)All 10+Local installFree, OSS
npm lodash (camelCase, snakeCase)Goodcamel, snake, kebab, start, upperLocal installFree, OSS
VS Code Multi-edit + extensionsManualAll via "Change Case" extensionLocal IDEFree

How do I convert camelCase to snake_case online?

Paste your camelCase identifier into the input field. The smart word splitter detects the case boundary on every uppercase letter — userName becomes user name internally, then re-joins as user_name for the snake_case output. The same operation happens automatically for all six other cases (kebab-case → user-name, PascalCase → UserName, UPPER_SNAKE → USER_NAME, Title Case → User Name, dot.case → user.name). Edge cases handled: consecutive capitals like HTTPSConnection split correctly as https connection (not h t t p s connection), digits stay attached to their preceding word (htmlParserV2html parser v2), and pre-existing separators (spaces, hyphens, underscores, dots) all serve as word boundaries.

What's the difference between camelCase, PascalCase, snake_case, and kebab-case?

Five conventions that all encode the same words differently — pick by language, by context, or by team style guide:

CaseExampleUsed in
camelCaseuserNameJavaScript / TypeScript variables, Java methods, Swift
PascalCaseUserNameClass names (most languages), C# methods, React components
snake_caseuser_namePython, Ruby, Rust, database column names
kebab-caseuser-nameURLs, CSS classes, HTML attributes, npm packages
UPPER_SNAKEUSER_NAMEConstants in most languages, environment variables
Title CaseUser NameHeadings, proper-noun rendering
dot.caseuser.nameSome config systems, Java property files

Decision rule: variable name → camelCase (JS) or snake_case (Python). Class name → PascalCase. URL slug → kebab-case (use the URL Slug Generator for SEO-friendly slugs). Constant → UPPER_SNAKE. Don't mix conventions within a single language; ESLint/Pylint enforce the language norm automatically.

Case converter alternative to convertcase.net — 4 reasons developers switched

  1. Programming-aware, not just text-aware. convertcase.net handles UPPERCASE / lowercase / Title / aLtErNaTiNg cases — useful for prose, useless for code. This tool handles every programming naming convention out of the box.
  2. Smart acronym splitting. XMLHttpRequestxml http request (correct) instead of xmlhttp request (wrong). Critical for refactoring legacy Java/C# codebases with classic acronym-heavy class names.
  3. All cases visible simultaneously. Paste once, see all 7 outputs side-by-side. Most tools force you to pick one target case per click — slows down "what should this snake_case become?" exploration.
  4. No ads, no popups. Tools indexed for "case converter" almost universally inject ads. This page is browser-only, ad-free, persists nothing.

Pair the case converter with the URL Slug Generator for SEO-friendly kebab slugs, the String Escape Tool for character-level transformations, the Regex Tester for pattern-based renames, and the Code & Text Tools hub for the broader text manipulation toolkit.

Case convention best practices

  • Follow your ecosystem's conventions. PEP 8 for Python, Airbnb/Standard for JS, Effective Go for Go. Rebellions cost code-review time forever.
  • Run a linter that enforces casing. ESLint id-match, Pylint invalid-name, Rubocop, gofmt — automatic enforcement > manual.
  • Keep file names and identifiers aligned. A UserProfile class lives in UserProfile.tsx (React) or user_profile.py (Python). Mixing breaks IDE shortcuts.
  • Use SCREAMING_SNAKE only for true constants and env vars. Module-level readonly values that are computed at runtime aren't constants — use camelCase or PascalCase.
  • Pick kebab-case for everything URL-ish. Slugs, CSS classes, HTML attributes, custom elements (<my-button>). Hyphens are URL-friendly and Google-friendly.
  • Avoid Hungarian notation in 2026. Prefixing with type (strName, iCount) is dated and adds noise. Type systems handle this now.
  • Title Case for headings, Sentence case for everything else. Most modern UIs (Apple, Material 3, Microsoft Fluent) recommend Sentence case for buttons and labels — feels less shouty.
  • For database columns, use snake_case. SQL identifiers fold to lowercase in PostgreSQL by default; quoting with "camelCase" is portability hell.

Frequently Asked Questions

What are the different naming conventions in programming?
The most common naming conventions are camelCase (JavaScript, Java variables), PascalCase (classes, React components), snake_case (Python, Ruby), UPPER_SNAKE_CASE (constants), kebab-case (CSS, URLs, HTML attributes), Title Case (headings), dot.case (property paths, package names), and path/case (file paths, module imports). Each convention is favored by different languages and communities, and consistency within a project is key.
How do I convert camelCase to snake_case?
To convert camelCase to snake_case, insert an underscore before each uppercase letter and then lowercase the entire string. For example, myVariableName becomes my_variable_name. This tool automatically detects camelCase word boundaries — including consecutive uppercase letters like parseHTMLString which becomes parse_html_string. Just paste your text and the conversion happens instantly.
When should I use kebab-case vs snake_case?
Use kebab-case for CSS class names, HTML attributes, URL slugs, and CLI flags — it is the web standard convention. Use snake_case for Python variables and functions, Ruby identifiers, database column names, and file names in many systems. The choice depends on the language or technology you are working with. JavaScript and CSS favor camelCase and kebab-case respectively, while Python and databases prefer snake_case. Consistency within a project matters more than the specific convention chosen.
What is PascalCase and where is it used?
PascalCase (also called UpperCamelCase) capitalizes the first letter of every word with no separators — for example, MyClassName or UserProfileSettings. It is used for class names in most object-oriented languages (Java, C#, Python, TypeScript), React and Vue component names, TypeScript interfaces and type aliases, C# method names and properties, and namespace declarations. PascalCase signals that an identifier represents a type, class, or constructor rather than a variable or function.
How do programming languages differ in naming conventions?
Different languages have established conventions: JavaScript uses camelCase for variables and functions, PascalCase for classes. Python uses snake_case for variables and functions, PascalCase for classes, and UPPER_SNAKE_CASE for constants. Java uses camelCase for methods, PascalCase for classes. CSS uses kebab-case for properties and class names. Go uses camelCase for private and PascalCase for exported identifiers. Ruby uses snake_case for methods and variables, PascalCase for classes. Following these conventions improves readability and team collaboration.

Browse all 50 free developer tools

All tools run in your browser, no signup required, nothing sent to a server.