Programming naming conventions

Every naming case developers use.

From camelCase to CONSTANT_CASE, every common programming naming convention with its rules, languages, and a smart tokenizer that handles acronym runs correctly.

Why naming conventions matter

Every programming language ecosystem has settled on naming conventions over decades of practice. Python uses snake_case. JavaScript uses camelCase. CSS uses kebab-case. SQL columns use snake_case. These conventions aren't arbitrary — each emerged because the alternative caused real friction with the syntax, tooling, or established libraries of that language.

Following the convention of your language matters more than picking the "best" convention in the abstract. Code that uses camelCase variable names in a Python codebase will pass syntax checks but fail every linter, look wrong to every reviewer, and create cognitive friction every time someone reads it. Convention is a coordination mechanism — its value comes from everyone following the same one.

The eight conventions covered here

This page links to detailed write-ups of the eight conventions that cover roughly 95% of programming naming needs:

  • camelCase — variables, methods, parameters in JavaScript, Java, Swift, C#, and most C-family and JVM languages.
  • PascalCase — class names, type names, React components, .NET public members, Go exported identifiers.
  • snake_case — Python, Ruby, Rust variables and functions; SQL column names; YAML keys.
  • kebab-case — CSS classes, HTML attributes, URL paths, CLI flags, Lisp-family identifiers.
  • CONSTANT_CASE — environment variables, compile-time constants, C macros, top-level configuration values.
  • dot.case — i18n translation keys, configuration namespaces, Java packages, structured logging fields.
  • path/case — URL routes, REST endpoints, file paths, S3 keys, container image names.
  • URL slugs — the hyphenated, lowercased, ASCII-only URLs that search engines and humans both prefer.

Tokenization is the hard part

Converting between case formats isn't difficult once you have correctly-identified tokens. The difficulty is identifying the tokens in the first place. parseXMLHttpRequest contains four tokens: parse, XML, Http, Request. A naive case converter that splits on every uppercase letter produces five tokens and mangles the acronym.

Our converter recognizes ALLCAPS acronym runs, numeric suffixes, brand-name exceptions (iPhone, eBay), and existing case boundaries. The same engine powers every page on this site — convert parseXMLHttpRequest to snake_case and you get parse_xml_http_request; convert it to kebab-case and you get parse-xml-http-request; convert it to CONSTANT_CASE and you get PARSE_XML_HTTP_REQUEST. The tokenization stays consistent across all output formats.

This matters because real-world inputs are messy. You're usually not converting clean three-word phrases — you're converting existing identifiers from one convention to another. Bad tokenization means a function called getHTMLContent ends up as get_h_t_m_l_content instead of the correct get_html_content. The acronym detection isn't optional.

Choosing between conventions

For new code, follow your language's standard. Python: snake_case. JavaScript: camelCase. CSS: kebab-case. Rust: snake_case for functions, PascalCase for types. The choice is made for you; just match it.

For new conventions in a polyglot codebase — say, JSON keys that flow between a Python backend and a JavaScript frontend — pick one and apply it everywhere. snake_case is the more common choice for JSON APIs because case-folding is less destructive than camelCase boundary detection. But camelCase is fine too if your team prefers it. What matters is consistency.

For identifiers that don't have a strong language convention — file names, directory structure, branch names in version control — kebab-case is the conservative default. It works everywhere, plays nicely with shells, and matches URL conventions.

Frequently asked questions

What is camelCase and how do I convert text to it?
camelCase lowercases the first word and capitalizes the first letter of every word after it, with no separators — userName. It's the standard for variables and function names in JavaScript, Java, Swift, and C#. Paste your text into the camelCase converter or the homepage converter to generate it instantly.

What is PascalCase and when should I use it?
PascalCase capitalizes the first letter of every word with no separators — UserProfile. Also called UpperCamelCase. Use it for class names, type names, React components, and .NET public members — anywhere the language convention expects a capitalized identifier for a "thing" rather than a variable.

What is snake_case and why is it used in database naming?
snake_case is all-lowercase with underscores between words — user_name. It's the standard for Python and Ruby code, and it dominates SQL column and table naming because it avoids the case-sensitivity ambiguity that some databases have with mixed-case identifiers.

What is CONSTANT_CASE and where does it show up?
All uppercase with underscores — MAX_RETRY_COUNT. Also called SCREAMING_SNAKE_CASE. Used for environment variables, compile-time constants, C macros, and top-level configuration values — the uppercase makes constants visually distinct from regular variables at a glance.

What is kebab-case and where is it used?
All lowercase with hyphens — user-profile. Also called dash-case or spinal-case. It's the standard for CSS class names, HTML attributes, URL paths, and CLI flags, since hyphens (unlike underscores) are safe in URLs and read cleanly in most contexts.

What is dot.case and what is it used for?
All lowercase with periods between words — user.profile.name. Common for i18n translation keys, configuration namespaces, and structured logging fields, where the dot notation mirrors nested object access.

What is path/case and how do I convert a Windows path to a web path?
All lowercase with forward slashes — users/profile/settings. Useful for URL routes and REST endpoints. Paste a Windows-style path with backslashes into the path/case converter and it normalizes the separators and casing for web use.

What is a slug URL and how do I make one?
A slug is the lowercase, hyphenated, ASCII-only portion of a URL — a blog title like "10 Best Tips for Writing!" becomes 10-best-tips-for-writing. The slug converter strips punctuation, replaces spaces with hyphens, and removes diacritics automatically.

Why do acronym runs break standard case converters?
A naive converter splits on every capital letter, turning parseXMLHttpRequest into five broken tokens instead of the correct four. The result is garbage like get_h_t_m_l_content instead of get_html_content — this engine specifically detects ALLCAPS acronym runs to avoid that failure mode.

Can I convert case styles inside my IDE?
Not with this tool directly — it's a browser-based converter, not an IDE plugin. Most editors (VS Code, JetBrains) have their own case-conversion extensions for in-editor use; this site is best for one-off conversions, bulk lists, or when you want the smart acronym tokenizer that many editor plugins lack.

What formatting style should REST API endpoints use?
kebab-case is the most common convention for URL paths and REST endpoints (/user-profiles/settings), since hyphens are safe in URLs and read more naturally than underscores or camelCase there. JSON payload keys are a separate decision — snake_case and camelCase are both common depending on whether the backend is Python-family or JavaScript-family.