Conversor de Case

Converta texto entre camelCase, PascalCase, snake_case e kebab-case

Converting Text Between Naming Conventions

Naming conventions vary across programming languages, frameworks, and contexts — JavaScript uses camelCase for variables, Python uses snake_case, CSS uses kebab-case, constants use SCREAMING_SNAKE_CASE, and class names use PascalCase. When working across multiple technologies, converting between these conventions is a frequent need: renaming database columns from snake_case to camelCase for JavaScript APIs, converting component names between frameworks, or transforming configuration keys between formats. The Case Converter handles bidirectional conversion between all major naming conventions with automatic case detection.

Type or paste text in any naming convention and see it instantly converted to all other formats. The tool automatically detects the input case format and splits words correctly — handling edge cases like consecutive uppercase letters in acronyms (HTMLParser → html-parser), numeric boundaries (user2name → user-2-name), and mixed conventions. All processing happens instantly in your browser.

Supported Naming Conventions

The converter supports all major programming naming conventions:

  • camelCase: First word lowercase, subsequent words capitalized — standard for JavaScript/TypeScript variables, Java methods, and JSON properties
  • PascalCase (UpperCamelCase): All words capitalized — used for class names in most languages, React components, and C# methods
  • snake_case: Words separated by underscores, all lowercase — standard for Python, Ruby, Rust variables, and database columns
  • kebab-case (dash-case): Words separated by hyphens, all lowercase — used for CSS classes, HTML attributes, URL slugs, and CLI flags
  • SCREAMING_SNAKE_CASE: Words separated by underscores, all uppercase — used for constants and environment variables
  • lowercase: All characters lowercase with no separator — used for package names and some identifiers

Word Boundary Detection

The converter intelligently detects word boundaries in any input format:

  • Case transitions: myVariableName → splits at lowercase-to-uppercase transitions
  • Separator characters: my-variable-name or my_variable_name → splits at separators
  • Acronym handling: HTMLParser → ["HTML", "Parser"] (keeps acronyms together)
  • Numeric boundaries: user2account → optionally splits at number-letter transitions
  • Mixed input: my-camelCase_mixed → handles inconsistent input gracefully

This intelligent splitting ensures that acronyms, numbers, and mixed-case inputs produce sensible conversions across all target formats.

Use Cases Across Development Workflows

Common scenarios where case conversion saves time:

  • API development: Converting database column names (snake_case) to JSON response keys (camelCase)
  • React development: Converting HTML attributes (kebab-case like class-name) to JSX props (camelCase like className)
  • Environment variables: Converting config keys to SCREAMING_SNAKE_CASE for .env files
  • File naming: Converting component names (PascalCase) to file names (kebab-case) following framework conventions
  • Database migrations: Renaming columns between language-native conventions
  • Code generation: Transforming schema field names into language-appropriate identifiers for generated code

The tool is particularly valuable when refactoring codebases that must maintain consistency across multiple naming conventions, such as a full-stack project where the frontend uses camelCase, the database uses snake_case, and environment configuration uses SCREAMING_SNAKE_CASE.

Code Examples

Conversion Examples Across All Formats

// Input: "getUserAccountData"
// Detected: camelCase

// Conversions:
// camelCase:       getUserAccountData
// PascalCase:      GetUserAccountData
// snake_case:      get_user_account_data
// kebab-case:      get-user-account-data
// SCREAMING_SNAKE: GET_USER_ACCOUNT_DATA
// lowercase:       getuseraccountdata

// Acronym handling:
// Input: "parseHTMLDocument"
// camelCase:       parseHtmlDocument
// PascalCase:      ParseHtmlDocument
// snake_case:      parse_html_document
// kebab-case:      parse-html-document
// SCREAMING_SNAKE: PARSE_HTML_DOCUMENT

// Practical use — API response mapping:
const dbColumns = ['user_id', 'first_name', 'created_at'];
const jsKeys = dbColumns.map(col =>
  col.replace(/_([a-z])/g, (_, c) => c.toUpperCase())
);
// Result: ['userId', 'firstName', 'createdAt']

Perguntas Frequentes

What case formats are supported?

The converter supports camelCase, PascalCase, snake_case, SCREAMING_SNAKE_CASE, kebab-case, dot.case, path/case, Title Case, and UPPERCASE. Each conversion correctly handles word boundaries regardless of the input format.

How does word splitting work for mixed formats?

The tool detects word boundaries by analyzing uppercase transitions (camelCase), separators (underscores, hyphens, dots, slashes), and spaces. This means input in any supported format is correctly split into words before converting to the target case.

How are acronyms handled during conversion?

Consecutive uppercase letters (like 'HTTP' or 'API') are treated as a single word. For example, 'HTTPClient' splits into ['HTTP', 'Client'], producing 'http_client' in snake_case or 'httpClient' in camelCase. This preserves the semantic meaning of acronyms during conversion.