How to Convert Text Case Between camelCase, snake_case, and 14 More
You're wiring a JavaScript front-end to a Python back-end and half your fields are camelCase, half are snake_case, and the database column is CONSTANT_CASE because someone in 2014 thought that was a good idea. You need to convert text case across forty identifiers, twice, without breaking anything. Find-and-replace gets you eighty percent there and quietly mangles the other twenty — XMLHttpRequest becomes xmlhttp_request instead of xml_http_request, file2name becomes filename, and your URL slug tool drops the accent on Café.
In this guide you'll learn how to convert text case between every common format using PDFFlare's Case Converter. Sixteen formats — lowercase, UPPERCASE, Title Case, Sentence case, camelCase, PascalCase, snake_case, CONSTANT_CASE, kebab-case, Train-Case, dot.case, path/case, Header-Case, Alternating, Inverse, and URL Slug — with smart word-splitting that handles tricky inputs correctly the first time, plus a live stats panel that catches length-budget issues before they ship.
What Is Text Case Conversion?
“Case” is the choice of capitalization and word separator for a string. lowercase keeps everything small. UPPERCASE shouts. camelCase drops separators and capitalizes subsequent words. snake_case uses underscores. kebab-case uses hyphens. Each convention exists because some downstream system requires it: GraphQL likes camelCase, SQL columns are commonly snake_case, URL paths want kebab-case, and HTTP headers want Train-Case (or Header-Case, same thing).
Converting between cases looks trivial — until you realize the same string can have ambiguous word boundaries. “XMLHttpRequest” is three words: XML, Http, Request. A naive lower-case-on-uppercase splitter will give you four words (xmlhttp, request) or worse. “file2name” splits as [file, 2, name], not [filename]. Doing this right requires a tokenizer that understands case transitions, acronym boundaries, and letter-digit splits.
The 16 Case Formats Explained
PDFFlare's tool exposes every common case format. Here's the practical guide:
- lowercase— “hello world.” Editorial copy, code identifiers in Go and Python.
- UPPERCASE— “HELLO WORLD.” Display emphasis, legal disclaimers, environment variables.
- Title Case— “Hello World.” Every word capitalized. Headings and CTAs.
- Sentence case— “Hello world.” Only the first letter and post-period letters capitalized.
- camelCase— “helloWorld.” JavaScript variables, Java methods, JSON field names.
- PascalCase— “HelloWorld.” Class names, type names, React components.
- snake_case— “hello_world.” Python and Ruby identifiers, SQL columns, REST API fields.
- CONSTANT_CASE— “HELLO_WORLD.” Environment variables, compile-time constants.
- kebab-case— “hello-world.” URL paths, CSS class names, command-line flag names.
- Train-Case— “Hello-World.” Legacy Lisp/Scheme convention.
- dot.case— “hello.world.” Java package names, hierarchical config keys.
- path/case— “hello/world.” URL and filesystem paths.
- Header-Case— “Hello-World.” HTTP headers (Content-Type, X-Forwarded-For).
- Alternating Case— “hElLo WoRlD.” Mocking memes; rarely useful in production.
- Inverse Case— “hELLO wORLD.” Each character flipped. Useful for testing case-sensitivity bugs.
- URL Slug — accent-folded, lowercased, non-alphanumeric becomes hyphens. CMS slugs and SEO-friendly URLs.
When to Use camelCase vs snake_case vs kebab-case
The choice is rarely about preference — it's dictated by the language or system. The practical rules:
- camelCase: JavaScript/TypeScript variables and methods, Java instance methods, JSON field names by convention, GraphQL fields. Whenever you're working in the JavaScript ecosystem, camelCase is the default.
- PascalCase: classes, types, interfaces, React components, C# everything-public. Capitalize the first letter when the identifier names a type or component, leave it lowercase when it names a value.
- snake_case: Python identifiers, Ruby identifiers, Rust functions and modules, SQL columns and tables, traditional REST API fields, file names on Unix.
- CONSTANT_CASE: environment variables (always), compile-time constants in many languages, config keys when shouted-readability matters.
- kebab-case: URL paths, CSS class names and custom properties, HTML attributes, command-line flags (--my-flag), filenames on the web.
Mixing cases inside a single project is fine — different contexts use different conventions and that's the point. The mistake is mixing cases inside a single context (some JSON fields camelCase, some snake_case in the same response). Pair PDFFlare's Case Converter with Text Diff to spot accidentally-mixed casing in a list of identifiers.
Using a camelCase converter in JavaScript projects
Most JavaScript and TypeScript style guides default to camelCase for variables and methods (Airbnb, Google, the standard ESLint defaults), and camelCase for JSON field names when the API is consumed by a JS front-end. A camelCase converter shines whenever you're translating from another source: Python snake_case responses, Rails JSON, SQL column listings. PDFFlare's tool reads any of those formats and emits the camelCase equivalent without you having to remember the regex rules each time.
When you need a snake case converter (Python, Ruby, SQL)
The flip side: the moment a JavaScript front-end talks to a Python or Ruby backend, you need to translate camelCase into snake_case for database columns, REST endpoints, or ORM attribute names. A purpose-built snake case converter preserves acronym boundaries (so XMLHttpRequest becomes xml_http_request, not xmlhttp_request) and treats numbers as their own tokens (file2name → file_2_name). Both are deal-breakers for naive find-and-replace approaches.
Kebab case generator for URLs and CSS
Web platform conventions are kebab-case all the way down: URL paths (/user-profile-page), CSS class names (.primary-button), HTML data attributes (data-user-id), and command-line flags (--max-old-space-size). A kebab case generator paired with the URL Slug option covers both the developer use case (CSS class names from PascalCase React components) and the editorial use case (slugifying a blog headline). PDFFlare's tool does both with the same input, just by switching the target format pill.
How to Convert Text Case with PDFFlare
Step-by-step with PDFFlare's Case Converter:
- Paste your text — anything from a single identifier to a full paragraph. The tool reads the entire input.
- Pick a target formatfrom the 16-button grid. Each pill shows the format's name and a live example so you don't have to remember which is which.
- Watch the live result — output updates as you type or switch formats. No Convert button, no waiting.
- Copy or chain— “Copy result” grabs the converted text. “Swap ↔” pushes the result back as input, useful for chained conversions (camelCase → snake_case → kebab-case).
- Check the stats panelat the bottom for characters, words, lines, paragraphs, sentences, reading time, and longest word — handy when you're also keeping an eye on a length budget.
Change text case in one click without keyboard shortcuts
Word and Google Docs both have built-in change-text-case shortcuts (Shift+F3 and Format → Text → Capitalization), but they're limited to UPPERCASE, lowercase, Title Case, and Sentence case — four formats out of the sixteen you'll actually need across a year of work. A standalone text case converter tool unlocks the rest: camelCase, snake_case, kebab-case, CONSTANT_CASE, dot.case, path/case, URL Slug, and the niche formats. One pill, one click, no menu hunting.
Smart Word Splitting (XMLHttpRequest and Friends)
The hard part of case conversion is not the formatting — it's the tokenizer. PDFFlare's splits on:
- Whitespace and common separators (space, tab, newline, hyphen, underscore, period, slash, backslash).
- lowercase → uppercase boundaries: “helloWorld” becomes [hello, World].
- Acronym boundaries: “XMLHttpRequest” becomes [XML, Http, Request] — a run of capitals followed by a capital-plus-lowercase splits between the second-to-last and last capital. This is how IOError becomes [IO, Error] and APIv2Endpoint becomes [API, v2, Endpoint].
- Letter → digit boundaries: “file2name” becomes [file, 2, name]. Numbers always become their own token, never silently merged.
The result: convert “XMLHttpRequest” to snake_case and you get xml_http_request, not xmlhttp_request. Convert “file2name” to kebab-case and you get file-2-name, not filename. These small details are the difference between a conversion you can trust on a forty-field schema and one you have to spot-check by hand.
A few more inputs worth highlighting: “parseURL” becomes [parse, URL], not [parseUR, L]. “getHTTPResponse” becomes [get, HTTP, Response]. “ID2Name” becomes [ID, 2, Name]. “userId42” becomes [user, Id, 42]. The same tokenizer powers all 16 output formats, so the round-trip property holds for these well-formed inputs: any case format can be converted to any other, then back, without losing tokens.
What the tokenizer does notdo: split based on a dictionary or natural language. “serverid” (no casing) is treated as one token. If you need it split, paste it as “serverId,” “server_id,” or “server-id” — the input has to encode the word boundaries somehow. This is by design: silent dictionary-based splitting would produce different results for different locales and become a debugging nightmare.
URL Slugs and Accented Characters
The URL Slug format does more than lowercase-and-hyphenate. It runs Unicode NFKD normalization on the input — which decomposes composed characters into base-character-plus-combining-mark sequences — then strips the combining marks. So:
- “Café” (with é) → “cafe”
- “Résumé” → “resume”
- “Naïve São Paulo” → “naive-sao-paulo”
- “The 10 Best Cafés!” → “the-10-best-cafes”
Punctuation is replaced by hyphens, multiple hyphens collapse into one, and leading/trailing hyphens are trimmed. The resulting slug is safe for URLs, file paths, and CMS identifiers without any further escaping. Need to double-check length? Open Word Counter alongside this tool — slugs over 60 characters get truncated in some search-result snippets.
Common Case Conversion Mistakes
- Mangling acronyms.“XMLHttpRequest” → “x_m_l_http_request” if your splitter treats every uppercase letter as a boundary. Or “xmlhttp_request” if it doesn't recognize acronym→capitalized-word transitions. The right answer is “xml_http_request.”
- Dropping numbers.Some tokenizers strip non-letter characters, turning “v2Endpoint” into “Endpoint” or “v Endpoint.” Numbers should always become their own token.
- Not folding accents in slugs.Naive lowercase-and-hyphenate gives you “café-résumé” — which works in modern URLs but breaks in plenty of legacy CMSes. Always NFKD-fold for slugs.
- Round-trip data loss.camelCase → snake_case should round-trip cleanly: helloWorld → hello_world → helloWorld. If your tool can't round-trip, the tokenizer is wrong.
- Sentence case for headlines.Sentence case decides word boundaries from punctuation, not human meaning. For headlines with abbreviations (“e.g.”) or proper nouns, prefer Title Case and edit by hand.
- Confusing Train-Case and Header-Case.They produce the same output (Hello-World) but the names belong to different communities. “Train-Case” is the Lisp/Lodash convention; “Header-Case” is what HTTP-header authors call it. Pick whichever your team uses so code reviewers don't pause to retranslate.
- Forgetting to trim before slugifying.“ Hello World ” with leading/trailing spaces becomes “-hello-world-” if your slugifier doesn't trim. PDFFlare's URL Slug option strips leading and trailing hyphens after the conversion, so input whitespace is harmless — but if you're rolling your own slugifier, the trim step is easy to miss.
Privacy: Are Online Case Converters Safe?
Most aren't actively malicious, but every server-side converter logs your input — sometimes for debugging, sometimes for ad personalization, sometimes both. PDFFlare's case converter runs entirely in your browser. Pure JavaScript functions transform the input on your machine. Nothing uploads, nothing logs.
That matters for a few specific cases: identifiers from a codebase under NDA, customer copy under embargo, internal API field names you'd rather not paste into a third-party tool. For everything else (refactoring your own side project, slugifying blog headlines), it probably doesn't matter — but defaults that respect privacy mean you don't have to think about it.
Related Tools
- Word Counter — count words, characters, sentences, and reading time. Pair with the case converter when you're also checking headline or meta-description length budgets.
- Text Diff — compare two strings or files line-by-line. Useful for spotting accidentally-mixed casing across a list of identifiers before/after conversion.
- Lorem Ipsum Generator — generate placeholder copy when you need to test how converted strings look at production length.
- URL Encode / Decode — for URL slug conversions where the result still needs additional percent-encoding for reserved characters.
Wrapping Up
Case conversion looks trivial until you realize the tokenizer is doing all the work. camelCase ↔ snake_case is a one-line regex if you control the input — and a forty-bug long-tail reality if you don't. Smart word-splitting that handles acronyms, letter-digit boundaries, and accented characters is the difference between “works” and “works on every input you can throw at it.”
Convert your next batch with PDFFlare's Case Converter — sixteen formats, smart word-splitting, live stats, all in your browser. No signup, no watermarks, no API quota. Just clean conversions.