Lowercase Converter
lowercase writes hello world example. It transforms every character to lowercase, leaving spacing and punctuation intact — the usual first step before normalising text for comparison or search.
Conversions
| Input | lowercase |
|---|---|
hello world example | hello world example |
XMLHttpRequest | xmlhttprequest |
user_first_name | user_first_name |
Total Order Count | total order count |
XMLHttpRequest becomes xmlhttprequest. That is irreversible — nothing in the output indicates where the words were.The Same Text in Other Cases
| Case | Result |
|---|---|
| camelCase | helloWorldExample |
| PascalCase | HelloWorldExample |
| snake_case | hello_world_example |
| SCREAMING_SNAKE_CASE | HELLO_WORLD_EXAMPLE |
| kebab-case | hello-world-example |
| Train-Case | Hello-World-Example |
Where lowercase Fits
Lowercasing is normalisation rather than naming: it is how you make comparisons case-insensitive, canonicalise an email address, or prepare text for a search index. It is not a naming convention because it destroys word boundaries.
Converting in Code
``javascript
const lower = (s) => s.toLowerCase();
`
Lower-casing is locale-sensitive. In Turkish, I lower-cases to a dotless ı, not i, which breaks case-insensitive comparison of ASCII identifiers on a Turkish system. Use toLowerCase(Locale.ROOT) or the invariant equivalent when the string is an identifier rather than prose.
Lowercasing for Comparison
Lowercasing is the standard normalisation step before comparing strings, and it is not
sufficient on its own.
`javascript
// Not enough — "café" has two Unicode representations
a.toLowerCase() === b.toLowerCase();
// Better — normalise Unicode first
a.normalize('NFC').toLowerCase() === b.normalize('NFC').toLowerCase();
// Best for user-facing comparison
a.localeCompare(b, undefined, { sensitivity: 'base' }) === 0;
`
The Unicode issue: é can be one code point (U+00E9) or two (e + combining acute). They
look identical, compare unequal, and both appear in real user input depending on the operating
system that produced it. macOS historically normalised filenames to NFD, Windows to NFC.
Use toLocaleLowerCase() rather than toLowerCase() where the input may be Turkish, and
lowercase email addresses on storage — the local part is technically case-sensitive per RFC
5321, but no mail provider treats it that way and users assume it is not.
Converting at the API Boundary
The recurring friction is that JavaScript uses camelCase and Python, Ruby, Go and SQL use
snake_case. The fix is to convert in exactly one place — the client that talks to the API —
rather than letting both conventions into the same codebase.
`javascript
const toCamel = (s) => s.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
const toSnake = (s) => s.replace(/[A-Z]/g, (c) => '_' + c.toLowerCase());
// Recursively, for a whole payload
const convertKeys = (value, fn) =>
Array.isArray(value)
? value.map((v) => convertKeys(v, fn))
: value && typeof value === 'object'
? Object.fromEntries(Object.entries(value).map(([k, v]) => [fn(k), convertKeys(v, fn)]))
: value;
`
Two things to watch: keys that are user data rather than field names must not be
converted, and the round trip is not always lossless — userID → user_id → userId
changes the original.
Where Each Convention Is Mandatory
Not stylistic — these will break if you deviate:
| Context | Requirement |
|---|---|
| Environment variables | Uppercase with underscores; POSIX reserves lowercase |
| Custom HTML elements | Must contain a hyphen |
| Python modules | Cannot contain hyphens; the import statement will not parse |
| SQL identifiers | Folded to one case unless quoted, so camelCase does not survive |
| React components | Must start uppercase, or JSX treats it as an HTML tag |
Renaming Safely
A find-and-replace across a codebase will hit strings, comments and unrelated identifiers.
Use your language server's rename symbol instead — it understands scope. For a bulk rename
across files, restrict the pattern with word boundaries and review the diff before
committing:
`bash
grep -rn '\buserId\b' src/ # look first
``