Skip to main content

toUpperCase() in JavaScript – How to Convert String to Uppercase

Whenever you use toUpperCase() on a string, the method does the following:

  1. It converts its calling string to uppercase.
  2. It returns the new version of the calling string—without changing the original string.
  • A calling string is a string on which you used toUpperCase(). So, in "Hello, World!".toUpperCase(), "Hello, World!" is the calling string.
  • toUpperCase() is sometimes written as String.prototype.toUpperCase() because it is a method of the String object's prototype property.

Syntax of the toUpperCase() Method

Here is toUpperCase()'s syntax:


The snippet above shows that toUpperCase() does not accept any argument.

Example 1: Convert CodeSweetly to Uppercase


// The invocation above will return: "CODESWEETLY"

Try Editing It

Example 2: Convert a JavaScript String to Uppercase

"friday, my friend, was born on friday".toUpperCase();

// The invocation above will return: "FRIDAY, MY FRIEND, WAS BORN ON FRIDAY"

Try Editing It


To convert a JavaScript string to lowercase, use toLowerCase().


String toUpperCase() method's

Use JavaScript's toUpperCase() method to convert your string to uppercase.

toUpperCase() returns the uppercase version of its calling string.

Your support matters: Buy me a coffee to support CodeSweetly's mission of simplifying coding concepts.

Tweet this article