This screaming snake case converter changes any name into SCREAMING_SNAKE_CASE. Type a phrase, a camelCase variable or a kebab-case key. The tool makes an uppercase name with an underscore between each word. Paste a list with one name on each line to convert all of the names at the same time.
Convert Names to SCREAMING_SNAKE_CASE
Type or paste names in the box. The tool shows the result immediately. Click Copy for one name or Copy all for a list.
Input:
userId
apiBaseUrl
max-retry-count
XMLHttpRequest
database url
Output:
USER_ID
API_BASE_URL
MAX_RETRY_COUNT
XML_HTTP_REQUEST
DATABASE_URL
What Is Screaming Snake Case?
Screaming snake case is a naming style for code. It has two rules:
- All letters are uppercase.
- An underscore (
_) separates each word.
The name comes from snake_case. snake_case also uses underscores, but with lowercase letters. The uppercase letters look like "screaming" text. Other names for the same style are UPPER_SNAKE_CASE, CONSTANT_CASE and MACRO_CASE.
| Style | Example |
|---|---|
| SCREAMING_SNAKE_CASE | MAX_FILE_SIZE |
| snake_case | max_file_size |
| camelCase | maxFileSize |
| PascalCase | MaxFileSize |
| kebab-case | max-file-size |
The Also as row under the result shows the first name in these other styles. Click a style to copy it.
When to Use SCREAMING_SNAKE_CASE
Constants
Many style guides use SCREAMING_SNAKE_CASE for values that do not change. Examples are JavaScript and TypeScript, Python (PEP 8), Java, C and C++.
const MAX_RETRY_COUNT = 3;
Environment variables
Shells, Docker, CI systems and .env files use SCREAMING_SNAKE_CASE for environment variable names.
DATABASE_URL=postgres://localhost/app
STRIPE_SECRET_KEY=sk_test_123
Feature flags and config keys
Teams use the same style for feature flags and configuration keys, for example ENABLE_NEW_CHECKOUT.
Make Environment Variable Names
Frameworks show only variables with a special prefix to the browser:
- Next.js:
NEXT_PUBLIC_ - Vite:
VITE_ - Create React App:
REACT_APP_
Click a Prefix chip to add the prefix to each name. To use a different prefix, type it in More options. If a name already has the prefix, the tool does not add it again.
To make .env lines, set .env lines to on in More options. The tool keeps each value after the = sign.
Input (prefix VITE_, .env lines on):
apiUrl=https://api.example.com
debugMode=true
Output:
VITE_API_URL=https://api.example.com
VITE_DEBUG_MODE=true
Click Download .env to save the result as a file.
How the Converter Splits Words
The converter starts a new word at:
- a space, a hyphen (
-), a dot (.) or an underscore (_) - an uppercase letter after a lowercase letter:
userNamebecomesUSER_NAME - the last capital of an acronym:
XMLHttpRequestbecomesXML_HTTP_REQUEST
Other rules:
- Numbers stay with the word before them.
base64UrlbecomesBASE64_URL. - Accents are removed.
cafébecomesCAFE. - Apostrophes are removed.
don't stopbecomesDONT_STOP. - Symbols are removed. The tool never makes two underscores together or an underscore at the start or the end.
- Correct names do not change.
API_KEYstaysAPI_KEY.
Common Mistakes
- The name starts with a number. Most languages and shells do not accept
2FA_CODE. Add a word or a prefix first, for exampleAPP_2FA_CODE. The tool shows a warning for these names. - The name has a space or a hyphen.
API-KEYis not a valid constant or variable name in most languages. UseAPI_KEY. - The browser prefix is missing. Next.js and Vite do not show a variable to browser code without
NEXT_PUBLIC_orVITE_. - Secrets have a public prefix. A variable with
NEXT_PUBLIC_orVITE_goes into the browser code. Do not put secret keys in these variables.
Explore More Free Developer Tools
- Case converter: change text to lowercase, title case and other text cases.
- Slug generator: make lowercase URL slugs with hyphens.
- Text replacer: replace each underscore with a space to change SCREAMING_SNAKE_CASE back into words.
- HTML indent code: indent the HTML templates that use your constants.
- Convert small letter to capital letter: make all letters uppercase and keep the spaces.
- CSV to JSONL: change CSV config tables into JSON Lines.
Your names stay in your browser. The tool does not send them to a server.
Paste your names above and copy your SCREAMING_SNAKE_CASE constants now.