String.prototype.toUpperCase()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

O método toUpperCase() retorna o valor da string original convertido em letras maiúsculas.

Sintaxe

str.toUpperCase()

Valor retornado

Uma nova string representando a string original convertida em maiúsculas.

Exceções

TypeError

Quando chamado em uma string contendo valor null ou undefined, por exemplo, String.prototype.toUpperCase.call(undefined).

Descrição

O método toUpperCase() retorna o valor da string convertido para letras maiúsculas. toUpperCase() não altera o valor da string original.

Exemplos

Uso básico

js
console.log("alfabeto".toUpperCase()); // 'ALFABETO'

Especificações

Specification
ECMAScript® 2025 Language Specification
# sec-string.prototype.touppercase
Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
toUpperCase

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Veja também