Convert camelCase to SCREAMING_SNAKE_CASE!

String
Result

Convert camelCase to SCREAMING_SNAKE_CASE!

Is the variable naming in the code you copied from somewhere else different from your code? Don't worry! It converts variables to your desired naming convention!

Turns camelCase names like apiBaseUrl and maxRetryCount into SCREAMING_SNAKE_CASE (API_BASE_URL, MAX_RETRY_COUNT), the style used for environment variables and constants.

It is handy when a settings object written in JavaScript, TypeScript or Java has to be exposed as .env entries, Docker/Kubernetes environment variables, or static final constants. Paste the object or the list of keys and you get the upper-case names with underscores in the right places.

How to use

  1. Check that the first dropdown says camelCase and the second says SCREAMING_SNAKE_CASE.
  2. Paste your config object, class fields or key list into String.
  3. Copy the Result text; the highlighted parts are the names that changed.

Example

Input (camelCase)
export const appConfig = {
  apiBaseUrl: "https://api.example.com",
  requestTimeoutMs: 5000,
  maxRetryCount: 3,
};
Output (SCREAMING_SNAKE_CASE)
export const APP_CONFIG = {
  API_BASE_URL: "https://api.example.com",
  REQUEST_TIMEOUT_MS: 5000,
  MAX_RETRY_COUNT: 3,
};

Both the variable name appConfig and its keys are converted because they are all camelCase. The URL inside quotes has no camelCase word, so it stays intact.

Supported features

  • Puts an underscore between words and upper-cases everything: requestTimeoutMs → REQUEST_TIMEOUT_MS. A run of capitals counts as one word.
  • Digits are kept in place: oauth2ClientId → OAUTH2_CLIENT_ID.
  • Converts every camelCase word in the pasted block at once, keeping values and punctuation unchanged.

Use cases

Generating .env keys from a config schema

If your app reads settings into an object such as { apiBaseUrl, sentryDsn }, convert the key list to get the matching API_BASE_URL and SENTRY_DSN names for .env, a Helm values file or a CI secret list.

Promoting variables to constants

Magic values that started as local variables (defaultPageSize, maxUploadBytes) can be renamed to constant style in one pass before moving them to a constants file.

Notes and limitations

  • Acronyms written in capitals stay together, so jwtTTL gives JWT_TTL and smtpHOSTName gives SMTP_HOST_NAME. Only two acronyms written back to back get merged into one segment.
  • Method calls such as toString or addEventListener in the pasted code are converted as well, so paste declarations or key lists rather than whole files.

FAQ

Does it also add export const or = signs?

No. Only the names change; the surrounding syntax stays as you pasted it. Edit the declaration keywords yourself if you are turning object keys into standalone constants.

Why is MAX_RETRY_COUNT not converted back if I paste it here?

This page only looks for camelCase words. An already upper-case name has no lowercase start, so it is not matched. Use the SCREAMING_SNAKE_CASE → camelCase page for the reverse direction.