Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

String.prototype.toUpperCase() — convert letters to uppercase

The toUpperCase() method returns text with letters converted to uppercase using Unicode default casing rules. It leaves the original unchanged, takes no arguments, and can change the length of the result.

Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support

Syntax

string.toUpperCase()

String.prototype.toUpperCase() returns a string value with letters converted to uppercase using the Unicode default algorithm. Call it as string.toUpperCase(), with no arguments. The original text remains unchanged; retain or pass on the returned value to use the converted text.

Conversion is not limited to ASCII. One code point can become several, so the result can have a different length: ß becomes SS. The digits and punctuation in the example remain unchanged. Converting to uppercase and then lowercase does not necessarily recover the original.

The method does not use a selected language or locale. When language-specific casing rules are needed, consider toLocaleUpperCase(). On its own, toUpperCase() is not a general mechanism for case-insensitive text comparison.

You can also call the method with value as the receiver using String.prototype.toUpperCase.call(value). The method throws a TypeError for null and undefined before conversion. Otherwise, it uses the ToString operation, which throws a TypeError for a Symbol primitive. It belongs to the ECMAScript standard library, not the DOM; the language specification is not a browser compatibility table.

Examples

const original = "Straße 123!";
const upper = original.toUpperCase();
console.log(original);
console.log(upper);
console.log(original.length, upper.length);

Result

Straße 123!
STRASSE 123!
11 12

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources