String#upcase

str.upcase -> string
Returns: string · Updated March 13, 2026 · String Methods
strings case conversion unicode

String#upcase returns a new string with all characters converted to uppercase. It is useful for emphasizing text, normalizing input, and formatting output for display.

This method does not modify the original string—it always returns a new string.

Syntax

string.upcase

Parameters

This method takes no parameters. It operates on all characters in the string.

Examples

Basic usage

"hello world".upcase
# => "HELLO WORLD"

"ruby programming".upcase
# => "RUBY PROGRAMMING"

With Unicode characters

"çàâ".upcase
# => "ÇÀÂ"

"über".upcase
# => "ÜBER"

"ångström".upcase
# => "ÅNGSTRÖM"

Working with special characters

"numbers: 123".upcase
# => "NUMBERS: 123"

"symbols: !@#".upcase
# => "SYMBOLS: !@#"

Common Patterns

Emphasis and constants

status = "active"
status.upcase
# => "ACTIVE"

# Common Ruby constant naming
module MyConstants
  DEFAULT_OPTIONS = {
    mode: "debug".upcase
  }
end

Conditional formatting

def format_status(active)
  active ? "ACTIVE" : "inactive"
end

format_status(true)
# => "ACTIVE"

format_status(false)
# => "inactive"

Enum-like status codes

def normalize_status(status)
  status.upcase
end

normalize_status("pending")
# => "PENDING"

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+.

See Also