Text Case Converter
Convert to UPPER, lower, camelCase, snake_case & more.
What is text case conversion?
Text case conversion is the act of transforming a string between casing conventions without changing the underlying word boundaries or meaning. The words stay; only how they are joined and capitalized changes. Our tool produces 11 conversions in parallel from a single input: UPPER, lower, Title Case, Sentence case, camelCase, PascalCase, snake_case, SCREAMING_SNAKE_CASE, kebab-case, dot.case, and AlTeRnAtInG. Each output is a deterministic re-rendering of the same tokens. A short round-trip makes the relationship explicit. Starting with the identifier myVariableName, the PascalCase form is MyVariableName, the snake_case form is my_variable_name, the kebab-case form is my-variable-name, and the SCREAMING_SNAKE_CASE form is MY_VARIABLE_NAME. Five renderings, one set of tokens, zero loss. The conversion is reversible as long as the source preserved word boundaries.
Naming conventions by language and context
Each ecosystem has settled on a small set of canonical cases, and mixing them inside a single layer reads as careless. The conventions worth memorizing are short.
- JavaScript and TypeScript: camelCase for variables and functions, PascalCase for classes and React components, SCREAMING_SNAKE_CASE for module-level constants like
MAX_RETRIES. - Python: snake_case for variables and functions, PascalCase for classes, SCREAMING_SNAKE_CASE for constants. PEP 8 codifies this and most linters enforce it by default.
- CSS: kebab-case for class names and custom properties. A custom property declared as
--brand-coloris idiomatic;--brandColoris not. - URLs: kebab-case. Google's Search Central guidance, consistent since 2011, treats hyphens as word separators and underscores as part of a single token, so
learn-typescriptindexes as two keywords whilelearn_typescriptindexes as one. - Databases: snake_case is the SQL convention for tables and columns. Some teams override to camelCase for ORM compatibility, which is a defensible tradeoff but a documented one.
- Environment variables: SCREAMING_SNAKE_CASE everywhere, on every platform, without exception.
Common pitfalls
Three traps account for most of the case-conversion bugs we see in code review. The conversions themselves are deterministic, but the inputs and the surrounding style decisions are where the inconsistency creeps in. Naming each pitfall makes it cheap to avoid.
- Auto-converting acronyms inconsistently.
XMLHttpRequestbecomesxmlHttpRequestunder the modern camelCase convention, but a great deal of older code usesXmlHttpRequest. Both are defensible; mixing them inside one project is not. We pick one acronym policy per codebase and apply it across the whole tree. - Mixing kebab-case and snake_case in the same layer of a system. Kebab-case in URLs alongside snake_case in database columns is fine because the layers are separated by a clear boundary. Mixing the two inside a single layer breaks the pattern recognition that lets a reader skim a file and predict where to look next.
- Title Case capitalization rules. APA and the Chicago Manual of Style disagree on which short words get capitalized: APA capitalizes all words 4 letters or longer plus all major content words regardless of length, while Chicago lowercases articles, prepositions, and conjunctions under 4 letters. Our converter follows APA because it produces the most consistent output across mixed-length headings without a per-word judgment call.
When to use this tool
We reach for the converter in three concrete situations. The first is a backend engineer migrating a Python codebase that drifted into accidental camelCase back into PEP-8-correct snake_case: pasting each offending identifier into the tool and copying the snake_case row is faster than wrestling with a regex that respects acronym boundaries. The second is a frontend engineer translating a PascalCase component name from a design document, say HeroBannerVariantA, into a kebab-case CSS class like hero-banner-variant-a for the matching stylesheet. Round-tripping through the tool keeps the two artifacts aligned without manual retyping. The third is an editor normalizing UPPERCASE shouting in user-submitted content, where a reviewer pastes a comment, copies the Sentence case row, and ships the cleaner version back into the moderation queue.
Frequently asked
- What's the difference between camelCase and PascalCase?
- Both join words by capitalizing each, but the first letter differs. camelCase keeps the first word lowercase and capitalizes the rest, like `myVariableName`. PascalCase capitalizes every word including the first, like `MyClassName`. We use camelCase for variables and functions in JavaScript and TypeScript, PascalCase for classes, types, and React components. The naming carries semantic weight: a PascalCase identifier in JSX is interpreted as a component, while a camelCase identifier is treated as a regular DOM tag.
- Why does Google prefer kebab-case in URLs?
- Google has stated for over a decade that hyphens act as word separators in URLs while underscores do not. The slug `learn-typescript` is read as two tokens; `learn_typescript` is read as one. Hyphens improve discoverability for keyword-bearing URL slugs because each token can match independently. The guidance has been consistent from Google's webmaster team since at least 2011, and it still appears in current Search Central documentation.
- Should I use snake_case or camelCase in JavaScript?
- camelCase. PEP 8 enforces snake_case for Python variables and functions, but JavaScript convention (TC39, Node, the npm ecosystem) is camelCase. snake_case in a JavaScript codebase usually signals either a Python port or inconsistent style and we treat it as a smell during review. We reserve SCREAMING_SNAKE_CASE for module-level constants like `MAX_RETRIES` or `DEFAULT_TIMEOUT_MS`, where it visually flags an immutable value at a glance.
- How does Title Case decide which words to capitalize?
- It depends on the style guide. APA capitalizes all words 4 letters or longer plus all major content words regardless of length. Chicago lowercases articles (a, an, the), prepositions, and conjunctions under 4 letters. AP capitalizes words of 4 or more letters and lowercases shorter ones except verbs. Our converter follows APA because it produces the most consistent output across mixed-length headings without forcing a per-word judgment call.
- Can I convert all 11 cases at once?
- Yes. Paste text once and the tool shows all 11 conversions in parallel rows: UPPER, lower, Title Case, Sentence case, camelCase, PascalCase, snake_case, SCREAMING_SNAKE_CASE, kebab-case, dot.case, and AlTeRnAtInG. Each row has a copy button. We built it that way because the most common workflow is 'I have an identifier in one case and want to compare options' rather than 'I know exactly which case I need before I start.'