Encodera

Thanks for reading!

Donate to the site — we work hard for you.

JavaScript reference

String.prototype.toLowerCase

Converts a string to lowercase.

Available since: ES1

Syntax

str.toLowerCase()

Return value

stringA new string in lowercase.

Examples

All letters become lowercase:

console.log('Hello, World'.toLowerCase());

Output:

hello, world

A case-insensitive comparison:

const input = 'ANNA@Example.com';
 
console.log(input.toLowerCase() === 'anna@example.com');

Output:

true

Notes

Strings in JavaScript are immutable: the method returns a new string and the original stays the same.

See also

Related recipes

In the tutorial

  • String methods — Useful string methods in JavaScript: finding a position, reading characters, padStart, repeat, split and join, method chains.

Thanks for reading!

Donate to the site — we work hard for you.