Python str.zfill() Online
Left-pad numeric strings with zeros.
Run details
The output updates as you type. The tool processes input in your browser.
Worked example
Zeroes are inserted after an optional plus or minus sign. Width includes the sign.
- Width
8
42
00000042
Python example
print("42".zfill(8))
Expected native output
00000042
Using this operation in Python
The interactive result uses JavaScript. Python str stores Unicode text. Encode to bytes when an API expects UTF-8 or another byte representation.