String#downcase
str.downcase -> string Returns:
string · Updated March 13, 2026 · String Methods strings case conversion unicode
String#downcase returns a new string with all characters converted to lowercase. It is useful for case-insensitive comparisons, normalizing user input, and formatting output for display.
This method does not modify the original string—it always returns a new string.
Syntax
string.downcase
Parameters
This method takes no parameters. It operates on all characters in the string.
Examples
Basic usage
"Hello World".downcase
# => "hello world"
"Ruby Programming".downcase
# => "ruby programming"
With Unicode characters
"ÇÀÂ".downcase
# => "çàâ"
"über".downcase
# => "über"
"Ångström".downcase
# => "ångström"
Working with special characters
"Numbers: 123".downcase
# => "numbers: 123"
"Symbols: !@#".downcase
# => "symbols: !@#"
Common Patterns
Case-insensitive comparison
When comparing strings without regard to case, convert both to lowercase first:
username = "JohnDoe"
username.downcase == "johndoe"
# => true
Normalizing user input
Many applications normalize user input to ensure consistent storage:
def normalize_name(name)
name.strip.downcase
end
normalize_name(" JOHN ")
# => "john"
normalize_name("ALICE")
# => "alice"
Unicode Support
Ruby handles Unicode properly. The method respects Unicode character properties, so it works correctly with international text. The Turkish dotted and dotless i problem is handled correctly in Ruby 2.5+.