References

Beginner-friendly references for web development, with live, editable examples.

The JavaScript string.toLowerCase() method

Method JavaScript All modern browsers Updated
Quick answer

The toLowerCase() method returns a new string with every letter in lowercase. "HELLO".toLowerCase() gives "hello". It's the everyday tool for case-insensitive comparison and search — normalize both sides to lowercase, then compare. The original is never changed.

Overview

toLowerCase() converts every letter in a string to lowercase and returns a fresh string. It's the more commonly used of the case-conversion pair, mostly because lowercasing is the conventional way to normalize text for comparison.

The pattern shows up everywhere: matching a search term against content, comparing email addresses, checking a value against a list of keywords. Convert both sides to lowercase and case differences simply stop mattering — title.toLowerCase().includes(query.toLowerCase()) is a search filter in one line.

As with toUpperCase(), the original string is left alone, and a handful of international characters and locales need toLocaleLowerCase() for correct results. For ordinary text, this method is the reliable default.

Syntax

const lower = str.toLowerCase()

"HELLO".toLowerCase()  // "hello"

Example

Live example
<pre id="out" style="font:15px ui-monospace,monospace"></pre>
<script>
  const items = ['Apple', 'Banana', 'Cherry'];
  const query = 'BAN';

  const matches = items.filter(
    item => item.toLowerCase().includes(query.toLowerCase())
  );

  document.getElementById('out').textContent = matches.join(', '); // Banana
</script>

Best practices

  • Normalize both strings to lowercase before comparing or searching to ignore case.
  • Use the return value; the original string is unchanged.
  • Combine it with includes() for a simple case-insensitive search filter.
  • Use toLocaleLowerCase() when locale-specific casing matters.

Frequently asked questions

How do I convert a string to lowercase in JavaScript?
Call str.toLowerCase(), which returns a new all-lowercase string.
How do I make a case-insensitive search?
Lowercase both the text and the term: text.toLowerCase().includes(term.toLowerCase()).
Does toLowerCase() modify the original string?
No. Strings are immutable, so it returns a new string and leaves the original as is.
When should I use toUpperCase() instead?
Either works for case-insensitive comparison as long as you apply the same one to both sides. Lowercasing is just the more common convention.