Case Converter

Case conversion is one of the most common micro-tasks in both software development and writing. Variable names need to match the convention of the host language (camelCase in JavaScript, snake_case in Python, kebab-case in CSS), URL slugs and HTML attributes need kebab-case, environment variables need CONSTANT_CASE, and article titles need Title Case or Sentence case depending on the style guide. Our case converter handles all of these in a single tool with 10+ output formats from one input. The conversion runs entirely in the browser — no text leaves your device — and supports any input length from a single word to a full code file or document. Smart word boundary detection means you can paste in mixed-format input (camelCase, snake_case, kebab-case, spaced text) and the converter recognises the structure correctly. Designed for developers working across JavaScript/TypeScript, Python, Java, Go, Ruby, C#, Rust and SQL, for technical writers maintaining documentation consistency, and for content creators preparing SEO-friendly URL slugs from article titles.

star 4.9
auto_awesome AI

Case Converter calculator

lightbulb Tips

  • camelCase for JS, snake_case for Python
  • PascalCase for class names in most languages
  • kebab-case for CSS classes and URL slugs
  • CONSTANT_CASE for env vars and constants

How to Convert Text to camelCase, snake_case and kebab-case

edit

Enter Text

Type or paste your text into the input area — any length, any starting case.

visibility

See All Formats

All 10+ case conversions appear instantly with live preview as you type.

content_copy

Copy Result

Click the copy button next to any format to copy it to clipboard.

integration_instructions

Use in Your Project

Paste into code, URL, CMS, environment file, or document where the format is needed.

The Formula

Case conversion is a two-step process: (1) split the input into discrete words by detecting word boundaries (spaces, underscores, hyphens, periods, camelCase humps where a lowercase letter is followed by an uppercase one), then (2) reformat the words according to the target case's separator and capitalization rules. Programming cases (camelCase, snake_case, kebab-case, CONSTANT_CASE) all share the same word-detection step and differ only in the rejoining rule, which is why the converter can move between any pair of formats.

camelCase → split words → lowercase first, capitalize rest → join

lightbulb Variables Explained

  • UPPERCASE All letters converted to uppercase (A-Z)
  • lowercase All letters converted to lowercase (a-z)
  • Title Case First letter of each word capitalized
  • Sentence case Only the first letter of the entire string capitalized
  • camelCase First word lowercase, subsequent words capitalized, no separator
  • PascalCase All words capitalized, no separator
  • snake_case All lowercase, words separated by underscores
  • kebab-case All lowercase, words separated by hyphens
  • CONSTANT_CASE All uppercase, words separated by underscores
  • dot.case All lowercase, words separated by periods

tips_and_updates Pro Tips

1

camelCase is standard for JavaScript/TypeScript variables and function names (per Airbnb, Google and Standard style guides)

2

PascalCase is used for class names in JavaScript, Java, C#, TypeScript and Python (PEP 8 class naming)

3

snake_case is standard for variables, functions and module names in Python (PEP 8) and in Ruby, plus database column names in SQL

4

kebab-case is mandatory for CSS class names, URL slugs and HTML custom element names (Web Components spec requires hyphens)

5

CONSTANT_CASE (SCREAMING_SNAKE) is the universal convention for constants, enum values and environment variables across all major languages

6

Title Case capitalizes the first letter of each word — ideal for blog post titles, book chapters, and section headings

7

Sentence case is preferred by major style guides (Google, Apple, Microsoft Manual of Style) for UI labels and body copy in modern technical writing

8

For URL slugs: always use kebab-case, ASCII-only, no diacritics — Google treats hyphens as word separators but underscores as connectors

Case conversion is a small task that comes up every day in software development and writing — and the wrong case in the wrong place can break a build, fail a linter, hurt SEO, or simply look unprofessional. JavaScript wants camelCase, Python wants snake_case, CSS wants kebab-case, environment variables want CONSTANT_CASE, blog titles want Title Case, and modern UI labels want Sentence case. Our converter handles all 10+ formats from any input, runs entirely in your browser, and works on any text length from one word to a full file. The sections below cover the format rules in detail, the conventions used by each major programming language, the SEO and accessibility implications of case choices in URLs and headings, and the edge cases (acronyms, Unicode, numbers, brand names) where naive case conversion produces wrong results.

The 10+ Case Formats Explained: UPPER, lower, Title, Sentence, camelCase, snake_case

UPPERCASE converts every letter to capitals (HELLO WORLD). lowercase converts every letter to small (hello world). Title Case capitalizes the first letter of each word (Hello World). Sentence case capitalizes only the first letter of the whole string (Hello world). camelCase joins words with no separator, lowercasing the first word and capitalizing subsequent words (helloWorld). PascalCase is the same as camelCase but capitalizes the first word too (HelloWorld). snake_case lowercases all letters and joins with underscores (hello_world). kebab-case lowercases all letters and joins with hyphens (hello-world). CONSTANT_CASE uppercases all letters and joins with underscores (HELLO_WORLD). dot.case lowercases and joins with periods (hello.world). Alternating case alternates upper and lower letter by letter (hElLo WoRlD). Each format encodes both a separator rule and a capitalization rule, and our converter handles all combinations of input format to output format.

camelCase vs PascalCase: When to Use Each in JavaScript, Java and C#

Both formats join words with no separator. The difference is the first letter — camelCase lowercases it (myVariableName), PascalCase capitalizes it (MyClassName). The convention across modern languages: camelCase for variables, function names, and method names; PascalCase for class names, type names, interface names, enums, and React/Vue/Svelte components. JavaScript example: const userAccount = getCurrentUser() — userAccount and getCurrentUser are camelCase; class UserAccount {} — UserAccount is PascalCase. Java: int totalAmount, void calculateTotal() (camelCase methods/fields), class Calculator (PascalCase classes). C#: more nuanced — public properties and methods are PascalCase (UserName, GetUserById), private fields use camelCase (often with _ prefix). TypeScript follows JavaScript conventions plus PascalCase for types and interfaces. React components must be PascalCase to render correctly — lowercase tag names are interpreted as HTML elements.

snake_case in Python, Ruby, SQL and JSON APIs

snake_case is the dominant convention in dynamic and scripting languages. Python PEP 8 mandates snake_case for function names, variable names, method names, module names, package names: def calculate_total(user_id), total_amount = 0, import data_processor. Constants are CAPS_WITH_UNDERSCORES (MAX_RETRY = 5). Classes are PascalCase (class UserAccount). Ruby uses snake_case throughout — methods, variables, file names — with constants in PascalCase or CONSTANT_CASE. SQL: standard naming for tables and columns is snake_case (user_accounts, created_at, last_login_date) — quoted identifiers preserve case but introduce fragility across databases. JSON: Python-generated and Ruby-generated APIs typically return snake_case field names (Stripe API, Twitter API, Django REST Framework). When transforming between Python backend and JavaScript frontend, choose one and convert at the API boundary (e.g., axios interceptor, Pydantic alias generators).

kebab-case for CSS Class Names, URL Slugs and HTML Attributes

kebab-case is required in three places: (1) CSS class names — .primary-button, .nav-link-active. JavaScript identifiers cannot contain hyphens, so CSS chose hyphens precisely to be impossible to confuse with JavaScript identifiers. (2) URL slugs — /blog/how-to-calculate-mortgage. Google explicitly recommends hyphens over underscores for word separation: hyphens are treated as word breaks, underscores as connectors, so 'best-running-shoes' indexes as three separate terms while 'best_running_shoes' indexes as one. (3) HTML attribute names — particularly data-* attributes and Web Components custom element names. The Web Components specification requires custom element names to contain a hyphen (my-component, not myComponent) to distinguish them from standard HTML elements. CSS custom properties (variables) also use kebab-case: --primary-color, --max-width. When CSS-in-JS frameworks transform property names, they convert camelCase JavaScript to kebab-case CSS automatically.

CONSTANT_CASE for Constants, Enums and Environment Variables

CONSTANT_CASE (also called SCREAMING_SNAKE_CASE or UPPER_SNAKE_CASE) signals 'this value never changes' across every major language. Use cases: (1) Language-level constants — JavaScript const PI = 3.14159, Java public static final int MAX = 100, Python ABSOLUTE_PATH = '/etc', Go const MaxRetries = 5 (though Go often uses MixedCase for exported constants). (2) Enum values — TypeScript enum Status { PENDING, IN_PROGRESS, COMPLETED }, Java public enum Status { PENDING, IN_PROGRESS }, Python's StrEnum members. (3) Environment variables — DATABASE_URL, NODE_ENV, AWS_ACCESS_KEY_ID across all OS and frameworks. (4) C/C++ macros — #define BUFFER_SIZE 1024, #define MAX_RETRY 5. (5) Docker compose YAML environment sections, Kubernetes ConfigMaps, GitHub Actions secrets, Vercel/Netlify dashboards. The visual SCREAMING distinction makes constants impossible to mistake for variables at a glance — that's the entire point of the convention.

Title Case vs Sentence Case: Rules for Headings and Writing

Title Case capitalizes the first letter of every word; Sentence case capitalizes only the first letter of the whole phrase plus proper nouns. Different style guides diverge on what to capitalize in Title Case. AP Style and APA: capitalize words of 4+ letters, do NOT capitalize short prepositions (in, on, at, of, by, to, for), articles (a, an, the), or coordinating conjunctions (and, but, or, nor) — unless they're the first or last word. Chicago Manual of Style: capitalize all words except articles, coordinating conjunctions, and prepositions regardless of length. New York Times: caps for words of 5+ letters. Modern tech style guides (Google, Apple, Microsoft Manual of Style) prefer Sentence case for UI labels, body copy, and even headings — it reads as less shouty and more conversational. SEO testing (CoSchedule, Backlinko) shows Title Case titles receive 14-20% higher CTR in search results, so use Title Case for blog post titles regardless of which body style you prefer.

Naming Conventions by Programming Language: JS, Python, Java, Go, Rust

Each language has codified conventions either in an official style guide or by community consensus. JavaScript/TypeScript: camelCase variables and functions, PascalCase classes/types/components, CONSTANT_CASE constants. Per Airbnb, Google and Standard style guides. Python: snake_case variables/functions/methods/modules, PascalCase classes, CAPS_WITH_UNDERSCORES constants. Mandated by PEP 8. Java: camelCase variables/methods, PascalCase classes/interfaces, CAPS_WITH_UNDERSCORES constants. Per Google Java Style Guide. Go: MixedCaps for both exported (capital first letter) and unexported (lowercase first letter) — gofmt enforces. Rust: snake_case for functions/variables/modules, PascalCase for types/traits, SCREAMING_SNAKE_CASE for constants. Per official Rust style guide. C#: PascalCase for everything public (methods, properties, classes), camelCase for parameters and private fields (often with _ prefix). Ruby: snake_case throughout, except classes/modules (PascalCase) and constants (PascalCase or CAPS_WITH_UNDERSCORES). Always match the surrounding code's convention rather than imposing your preferred style.

URL Slug Best Practices: Why kebab-case Wins for SEO

URL slugs should be lowercase kebab-case for four reasons. (1) Google word-separation: hyphens are treated as word separators in URLs, underscores are treated as connectors. /best-running-shoes ranks for 'best', 'running', 'shoes' independently; /best_running_shoes is treated as one compound term. (2) Case sensitivity: Apache, nginx, and other servers may treat /About and /about as different URLs by default — duplicate content penalty risk. Always use lowercase. (3) User-typed reliability: capital letters cause typos; lowercase URLs are easier to share verbally or write in print. (4) Standards alignment: RFC 3986 treats paths as case-sensitive, but the de facto web convention is lowercase. Best practice: strip diacritics (café → cafe), transliterate non-ASCII characters, drop articles (the/a/an) to shorten, target 60-70 character slugs for optimal SEO display in SERPs. Avoid: dates in slugs (date them in publish metadata), session IDs, query parameters embedded in slugs.

Acronyms in PascalCase and camelCase: HTTPRequest vs HttpRequest

Acronyms are the trickiest part of programming case conventions because two competing approaches exist. Approach A (preserve acronyms): HTTPRequest, HTMLParser, UserID, JSONResponse, URLBuilder. Older C, C++, Java code from the 1990s-2000s used this. Easier to identify acronyms at a glance. Approach B (treat as words): HttpRequest, HtmlParser, UserId, JsonResponse, UrlBuilder. Microsoft .NET, Google Java Style, modern TypeScript and JavaScript favor this. Easier to read multi-acronym names like HtmlHttpClient vs HTMLHTTPClient. Microsoft's rule: two-letter acronyms keep both letters capitalized (IOStream, IPAddress) but three+ letter acronyms become Pascal (HtmlParser, not HTMLParser). Google Java Style: always treat as words (HtmlParser, not HTMLParser, even for 3-letter HTML). Our converter applies Approach B by default. When working in an existing codebase, always match the established style — introducing a new acronym convention causes inconsistency that lingers for years.

Case Sensitivity in URLs, JSON, HTML, SQL and File Systems

Different contexts have different case sensitivity rules. URLs: technically case-sensitive (RFC 3986) but most web servers treat paths case-insensitively by default — always lowercase for safety and SEO. HTML: tag and attribute NAMES are case-insensitive (DIV = div = Div), but attribute VALUES are case-sensitive (class names, ID values must match exactly when referenced from CSS/JS). JSON: fully case-sensitive — {"userName": ...} and {"username": ...} are different fields. SQL: depends on database — MySQL on Windows is case-insensitive for table names, MySQL on Linux is case-sensitive; PostgreSQL folds unquoted identifiers to lowercase but preserves quoted ones; SQLite is case-insensitive by default. File systems: Windows NTFS and macOS APFS (default) are case-insensitive but case-preserving; Linux ext4 and macOS APFS (case-sensitive option) are case-sensitive. Git on case-insensitive file systems can cause silent issues when collaborators on case-sensitive systems pull. Best practice: enforce one case per system via lint rules, IDE settings, or git config (core.ignorecase).

Converting Variable Names Across a Codebase: IDE Tools and Refactoring

For single variables: paste into our converter, get the result, paste back. For bulk renames within a file or project, use the safest tool available. IDE rename refactor (F2 in VS Code, Shift-F6 in JetBrains, Cmd-R-R in Xcode): safest option — updates all references including imports, comments (optional), and dynamic strings (often). Project-wide find-replace with regex: faster but risky — manually verify each substitution and run tests after. Command-line: ripgrep with --pcre2 plus sed pipeline for systematic renames across many files. AST-based tools: jscodeshift for JavaScript/TypeScript, libcst for Python, OpenRewrite for Java — safest for complex changes involving thousands of files with semantic understanding. For converting an entire JSON API response from snake_case to camelCase, use a transformation library at the API boundary (camelCase-keys for Node, humps for JS, Pydantic alias generators for Python). Never run bulk renames on a dirty git working tree — branch, refactor, test, then merge.

Common Case Conversion Pitfalls: Unicode, Numbers, Brand Names and Edge Cases

Naive case conversion fails on several edge cases. (1) Acronyms — covered above, requires explicit convention choice. (2) Numbers in identifiers — should '2024Q4Revenue' become '2024_q4_revenue' or '2024_q_4_revenue'? Most converters split letter-digit transitions but not digit-letter; ours preserves digit groups. (3) Unicode case mapping — German ß lowercases to 'ss' but uppercases to ẞ (2017 official) or 'SS' (legacy). Turkish dotted/undotted i has locale-specific rules. Greek final sigma (ς) vs medial (σ) doesn't survive round-trip case operations. (4) Brand names with internal capitalization — iPhone, eBay, YouTube — should be preserved exactly, never converted. Add brand names to your editor's case-exception list. (5) Initialisms vs acronyms — NASA is an acronym (pronounced as a word), FBI is an initialism (pronounced as letters) — style guides treat them identically but they read differently. (6) Mixed-language text — converting CJK characters mixed with Latin has no defined behavior; most tools pass CJK through unchanged. Our converter handles standard Unicode for Latin/Cyrillic scripts and passes CJK characters through; for production multilingual systems, use ICU-based libraries (icu4j, PyICU) for locale-aware case operations.

code

Embed this Case Converter on your site

Free for any site. Copy the snippet below and paste into your HTML — no attribution required beyond the built-in credit link.

<iframe src="https://calculators.im/embed/case-converter" width="100%" height="720" style="border:0;max-width:100%;" loading="lazy" title="Case Converter by Calculators.im"></iframe>
<p style="font-size:12px;text-align:center;color:#64748b;margin-top:6px;">Powered by <a href="https://calculators.im/case-converter?utm_source=embed&utm_medium=snippet&utm_campaign=case-converter">Case Converter</a> by Calculators.im</p>
open_in_new Preview embed Auto-resizing iframe. Mobile responsive. Works with WordPress, Ghost, Webflow, and plain HTML.

Frequently Asked Questions

sell

Tags