Pads string on the right until it reaches a target length. Part of Lodash String (since 4.0.0 — 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 _.padEnd. Start with this line.
Lodash
_.padEnd([string=''], [length=0], [chars=' '])
Call
What it does
_.padEnd([string=''], [length=0], [chars=' '])
Primary signature.
_.padEnd(string)
Transform or inspect a string.
Prefer import padEnd from "lodash/padEnd" when you want a smaller bundle.
_.padEnd 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. Native String.prototype.padEnd (ES2017) covers the same idea in current engines.
✓ Stable · Lodash 4.x
_.padEnd()
Available in [email protected] full builds and the lodash/padEnd 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
_.padEndSince 4.0.0
Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import padEnd from "lodash/padEnd" for smaller builds. Use native padEnd in modern-only codebases if you prefer zero Lodash for this helper.
Frequently Asked Questions
_.padEnd([string=''], [length=0], [chars=' ']) pads string on the right until it reaches length. Official: _.padEnd('abc', 6) → 'abc '.
If string.length >= length, the original string is returned unchanged. Official: _.padEnd('abc', 3) → 'abc'.
Yes. Official: _.padEnd('abc', 6, '_-') → 'abc_-_'. Extra pad chars are truncated to fit the needed width.
padEnd adds on the right; padStart adds on the left. _.pad() pads both sides.
Yes. String.prototype.padEnd (ES2017) is similar. Lodash remains useful for older runtimes and Lodash pipelines.
Use import padEnd from "lodash/padEnd" or require("lodash/padEnd"). Full build: import _ from "lodash" then _.padEnd.