Overview
Introduction
When you print a list of numbers in a monospace font, right-aligning them so the ones digits all line up in the same column makes the list far easier to scan and compare.
This tool does that automatically: it finds the widest value in your list and pads every other value with leading spaces to match it.
What Is Integer Right Aligner?
A list-wide alignment tool that renders a batch of integers as a single monospace text block, with every value right-aligned to a shared width.
Unlike per-line padding tools, the padding target here is derived from the list itself (the longest value's width), not a number you type in.
How Integer Right Aligner Works
Each line is parsed as an integer, blank lines are skipped, and invalid lines are rejected before alignment runs.
The tool finds the maximum string length (including sign) across every parsed value in the list.
Every value is then padded with leading spaces via `padStart` to that shared maximum width, and the results are joined back into one block, one value per line.
When To Use Integer Right Aligner
Use it to prepare a readable, aligned column of numbers for a plain-text report, log output, or code comment.
It's useful whenever you need numbers to visually line up by their ones digit, such as when eyeballing a list of totals or offsets.
Often used alongside Integer Center Aligner and Integer Left Padder.
Features
Advantages
- Requires no manual width configuration; the alignment width always adapts automatically to the list's own longest value.
- Produces output that reads cleanly in any monospace context without further formatting.
Limitations
- Requires a monospace font or context to actually display the columns aligned; in a proportional font, the spaces won't visually line up.
- Since the width is list-wide, adding one much longer value to the list will widen the padding for every other value too.
Examples
Best Practices & Notes
Best Practices
- View the output in a monospace font/context (like a code block) so the alignment is visible as intended.
- Use Integer Center Aligner instead if you want values centered rather than right-aligned within the shared width.
Developer Notes
The shared width is computed once via `Math.max(...values.map(v => v.length))` before any padding happens, which is what distinguishes this from a per-line padding tool like Integer Left Padder that uses a user-supplied fixed width instead.
Integer Right Aligner Use Cases
- Formatting a column of numbers for a plain-text report, README, or log file
- Visually comparing a list of totals, offsets, or scores by their aligned digits
- Preparing monospace output for a terminal or code comment block
Common Mistakes
- Viewing the output in a proportional font, where the space-padding won't visually align the columns.
- Expecting to set a custom width — the alignment width is always derived automatically from the list's longest value.
Tips
- Add a deliberately wide dummy value temporarily if you want extra breathing room in the aligned column.
- Pair with Integer Left Padder if you specifically need zero-padding rather than space-alignment.