Convert kebab-case to SCREAMING_SNAKE_CASE!

String
Result

Convert kebab-case 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 kebab-case names into SCREAMING_SNAKE_CASE: listen-port → LISTEN_PORT, max-body-size → MAX_BODY_SIZE. This is the step from a CLI flag or a YAML key to the environment variable that overrides it, the pattern behind tools that accept both --log-format and LOG_FORMAT.

Paste the keys of a config file or the flags from --help output to get the matching variable names for .env files, Dockerfiles and CI settings.

How to use

  1. Choose kebab-case on the left and SCREAMING_SNAKE_CASE on the right.
  2. Paste YAML keys, flag names or a --help excerpt into String.
  3. Copy the result; add your app prefix (for example MYAPP_) if your tool requires one.

Example

Input (kebab-case)
listen-port: 8080
log-format: json
max-body-size: 1mb
Output (SCREAMING_SNAKE_CASE)
LISTEN_PORT: 8080
LOG_FORMAT: json
MAX_BODY_SIZE: 1mb

Each YAML key becomes the upper-case environment variable name; values such as json and 1mb are not kebab-case, so they are kept.

Supported features

  • Turns every hyphen into an underscore and upper-cases the name: log-format → LOG_FORMAT, retry-2-times → RETRY_2_TIMES.
  • Characters around a name, including a leading --, are left in place.
  • Words without a hyphen are not matched, so plain values stay lowercase.

Use cases

Documenting env overrides for a CLI

If a Go or Rust CLI binds flags to environment variables (as viper or clap's env feature can), converting the flag list gives the variable names to document.

Docker and CI from a YAML config

When a service reads listen-port from config.yaml but also allows an environment override, the converted names are what goes into docker-compose.yml or the CI secret settings.

Notes and limitations

  • If you paste flags with --, the dashes remain: --log-level → --LOG_LEVEL. Paste names without the prefix.
  • Short expressions like x-1 also look like kebab-case and become X_1, so keep arithmetic out of the input.

FAQ

Does it add a prefix such as APP_?

No. Add it in your editor afterwards, or include it in the input as app-listen-port.

What about keys like http2-enabled?

They convert cleanly to HTTP2_ENABLED, because the digit is part of the first segment.