Java String toLowerCase()

The Java String toLowerCase() method converts all characters in the string to lower case characters.

The syntax of the string toLowerCase() method is:


Here, string is an object of the String class.

toLowerCase() Parameters

The toLowerCase() method does not take any parameters.

toLowerCase() Return Value

  • returns a string with all upper case letters converted to lower case letters

Example: Java toLowerCase()

class Main {
  public static void main(String[] args) {
    String str1 = "Learn Java";
    String str2 = "Java123";

    // convert to lower case letters
    System.out.println(str1.toLowerCase()); // "learn java"
    System.out.println(str2.toLowerCase()); // "java123"

As you can see from the above example, toLowerCase() converts all upper case letters to lower case letters.

toLowerCase() With Locale Parameter

The toLowerCase() method can also take a locale as an argument. This allows you to convert characters in a string to lower case using the given Locale (such as: Turkish, Lithuanian etc.) rules.

Its syntax is:

string.toLowerCase(Locale locale)

If you do not pass the locale parameter, the default locale, Locale.getDefault(), is used.

To learn more, visit Java toLowerCase() With Locale.

To convert all characters in a string to upper case characters, use the Java String toUpperCase() method.