JavaScript String.padStart() Online
Pad start of string.
Run details
The output updates as you type. The tool processes input in your browser.
Worked example
Fill is inserted before the original text. Zero padding is useful for fixed-width labels or identifiers.
- Width
8- Fill
"0"
42
00000042
JavaScript example
console.log("42".padStart(8, "0"));
Expected native output
00000042
Using this operation in JavaScript
The interactive result uses JavaScript. JavaScript string indexes count UTF-16 code units. Use code-point iteration when working with supplementary Unicode characters.