Converts a string, as a whole, to uppercase — same idea as String#toUpperCase. Separators stay put; only letters change case. Part of Lodash String (stable since 4.0.0 — not deprecated).
Pass the string and options shown below. Check the return type before you chain another helper.
Syntax
Call _.toUpper. Start with this line.
Lodash
_.toUpper([string=''])
Call
What it does
_.toUpper([string=''])
Primary signature.
_.toUpper(string)
Transform or inspect a string.
Prefer import toUpper from "lodash/toUpper" when you want a smaller bundle.
Library declarations
Lodash
_.toUpper([string=''])
Parameters
Parameter
Description
string
Optional. Value to convert (default ''; non-strings are coerced)
_.toUpper is a Lodash String helper available since 4.0.0. It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash.
✓ Stable · Lodash 4.x
_.toUpper()
Available in [email protected] full builds and the lodash/toUpper modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.
100%With Lodash 4.x
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.toUpperSince 4.0.0
Bottom line: Safe for production once Lodash is on the page. Prefer import toUpper from "lodash/toUpper" for smaller builds. Native String#toUpperCase is fine when you do not need Lodash.
Frequently Asked Questions
_.toUpper([string='']) converts the whole string to uppercase, like String#toUpperCase. Official: _.toUpper('--foo-bar--') → '--FOO-BAR--'.
_.toUpper only changes letter case and keeps separators. _.upperCase splits into space-separated uppercase words (e.g. '--foo-bar--' → 'FOO BAR').
For plain strings they usually match. Lodash coerces non-strings first and fits the rest of the Lodash string API.
No. Strings are immutable. _.toUpper always returns a new string.
Use _.toLower for lowercase normalization, slugs, or case-insensitive storage. Use _.toUpper for labels, codes, and display caps.
Use import toUpper from "lodash/toUpper" or require("lodash/toUpper"). Full build: import _ from "lodash" then _.toUpper.