SCREAMING_SNAKE_CASE converter

Turn phrases and other naming styles into SCREAMINGSNAKECASE: capital letters joined by underscores, the usual style for constants and environment variables. The conversion runs in your browser and nothing is uploaded, which is handy for the names in a .env file.

How it works

  1. Paste your text

    Type or paste the text in the left box, or open a .txt file. No text to hand? Click Example.

  2. Instant result

    The result appears as you type. Change the options and see straight away what changes.

  3. Copy or download

    Copy the result with one click, save it as a file or use it as input for a next step.

Examples

Input Result
max attempts MAX_ATTEMPTS
apiKey API_KEY
default-time-out DEFAULT_TIME_OUT

Words are found at spaces, hyphens, underscores and camelCase boundaries; accents are removed and apostrophes dropped. Each line is converted on its own, which is handy for a list of constants.

A configuration example

Take a settings list and convert it to variable names in one go: database host, database port and secret key become DATABASE_HOST, DATABASE_PORT and SECRET_KEY. Prefix them with the name of your app if you share an environment with others, such as MYAPP_SECRET_KEY.

Not for everything

Constants in JavaScript are sometimes written in camelCase, so check what your project's style guide says. Use snake case for ordinary variables in Python and Ruby, and camelCase for JavaScript variables.

Frequently asked questions

Where is SCREAMING_SNAKE_CASE used?

For constants in Python, Java, JavaScript and C, such as `MAX_RETRIES`, and for environment variables such as `DATABASE_URL` and the variable names in a `.env` file.

How is it different from just making text uppercase?

The [uppercase converter](/en/text/uppercase-converter) keeps spaces and punctuation. This tool also splits camelCase, removes accents and punctuation and joins the words with underscores.

Can I convert a list of environment variables?

Yes. Paste one name per line; each line becomes its own constant. `apiKey`, `db host` and `default-time-out` become `API_KEY`, `DB_HOST` and `DEFAULT_TIME_OUT`.

Why capitals and underscores?

Capitals mark a value that should not change, and underscores are valid in identifiers where spaces and hyphens are not. Shell variables cannot contain hyphens either.