Convert snake_case to SCREAMING_SNAKE_CASE!

String
Result

Convert snake_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!

Upper-cases snake_case names while keeping the underscores: default_page_size → DEFAULT_PAGE_SIZE. In Python (PEP 8), Rust, C and shell scripts, module-level constants are written this way, while ordinary variables use lowercase snake_case.

Use it when values that started life as local variables or function arguments become fixed settings, or when you need environment variable names that match existing snake_case config keys.

How to use

  1. Choose snake_case → SCREAMING_SNAKE_CASE in the two dropdowns.
  2. Paste the assignments or names into String.
  3. Copy the Result; values on the right-hand side of each assignment are not modified.

Example

Input (snake_case)
default_page_size = 20
max_upload_mb = 10
_cache_ttl_seconds = 300
Output (SCREAMING_SNAKE_CASE)
DEFAULT_PAGE_SIZE = 20
MAX_UPLOAD_MB = 10
_CACHE_TTL_SECONDS = 300

All three names are upper-cased. _cache_ttl_seconds keeps its leading underscore, which in Python marks a module-private constant.

Supported features

  • Keeps every underscore and upper-cases the letters, so digit segments survive cleanly: retry_after_2x → RETRY_AFTER_2X.
  • Preserves one leading underscore: _cache_ttl_seconds → _CACHE_TTL_SECONDS.
  • Single words without an underscore (timeout) are not snake_case to this tool and remain lowercase.

Use cases

Pulling magic numbers into constants

In a Python module, values like max_upload_mb = 10 scattered through functions can be lifted to the top of the file as MAX_UPLOAD_MB, which linters and readers recognise as constants.

Env var names from config keys

If a YAML or TOML config uses database_url and log_level, the matching environment overrides are usually DATABASE_URL and LOG_LEVEL (pydantic-settings, for example, maps them this way).

Notes and limitations

  • One-word names stay lowercase. If timeout should be a constant too, write TIMEOUT yourself.
  • Every snake_case word in the text is upper-cased, including function names like get_user if they appear in the pasted code.

FAQ

Is anything lost going from snake_case to SCREAMING_SNAKE_CASE?

No. The separators are identical, so the conversion is fully reversible with the opposite page, apart from words you edited.

Why isn't __all__ changed?

Names with two leading underscores are not matched by the snake_case pattern, which only allows a single optional leading underscore.