Pad a string on the left until it reaches a target length. Part of Lodash String (stable — not deprecated). Padding characters are truncated if they exceed the needed width.
Pass the string and options shown below. Check the return type before you chain another helper.
Syntax
Call _.padStart. Start with this line.
Lodash
_.padStart([string=''], [length=0], [chars=' '])
Call
What it does
_.padStart([string=''], [length=0], [chars=' '])
Primary signature.
_.padStart(string)
Transform or inspect a string.
Prefer import padStart from "lodash/padStart" when you want a smaller bundle.
_.padStart is a Lodash String helper available in 4.x. It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Native String.prototype.padStart (ES2017) covers the same idea in current engines.
✓ Stable · Lodash 4.x
_.padStart()
Available in [email protected] full builds and the lodash/padStart 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
_.padStartLodash 4.x
Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import padStart from "lodash/padStart" for smaller builds. Use native padStart in modern-only codebases if you prefer zero Lodash for this helper.
Frequently Asked Questions
_.padStart([string=''], [length=0], [chars=' ']) pads string on the left until it reaches length. Official: _.padStart('abc', 6) → ' abc'.
If string.length >= length, the original string is returned unchanged. Official: _.padStart('abc', 3) → 'abc'.
Yes. Official: _.padStart('abc', 6, '_-') → '_-_abc'. Extra pad chars are truncated to fit the needed width.
Pass '0' as chars: _.padStart('42', 5, '0') → '00042'.
padStart adds on the left; padEnd adds on the right. _.pad() pads both sides.
Yes. String.prototype.padStart (ES2017) is similar. Lodash remains useful for older runtimes and Lodash pipelines.