Zero Padding

Zero padding is a process of filling in ‘0’ when representing a number in characters, if it does not meet the specified number of digits. Not only at the beginning, but also at the end in the case of decimals, ‘0’ is added. It is mainly used for displaying dates and creating fixed-length data.

For example, if you represent 123 in 5 digits, it becomes ‘00123’. When zero-padding a signed number, care must be taken not to add ‘0’ before the sign.

The opposite of zero padding, the process of removing extra zeros, is called zero suppression.

Examples of Zero Padding

Related Terms