Numfmt - Number Formatting Utility | Online Free DevTools by Hexmos

Format numbers with Numfmt. Convert bytes to human-readable formats, apply prefixes, and more. Free online number formatting tool.

Numfmt - Number Formatting Utility

Understand Numfmt for Number Formatting

Numfmt is a powerful command-line utility designed for formatting numbers. It allows you to convert numerical values into human-readable formats, making them easier to understand, especially for large numbers or file sizes. This tool is invaluable for developers and system administrators who frequently work with data and need to present it clearly.

Convert Bytes to Human-Readable Format

One of the most common uses of numfmt is converting raw byte counts into human-readable file sizes (e.g., KB, MB, GB). This is achieved using the --to=iec or --to=si options, often combined with suffixes like --suffix=B for byte units.

# To convert bytes to Human readable format using IEC standard (KiB, MiB, GiB)
numfmt --to=iec --suffix=B --padding=7 1048576

# Example Output:
#   1.0MiB

Apply Prefixes and Padding

Numfmt also supports applying various prefixes and padding to align numbers. This is useful for creating neatly formatted tables or reports where numbers need to occupy a consistent width.

# Example with padding
numfmt --padding=10 12345

# Example Output:
#      12345

Explore Numfmt Options

The numfmt utility offers a wide range of options for customizing number output. You can control units, prefixes, rounding, and more. Refer to the official documentation for a comprehensive list of features and advanced usage.