Text Padding
Pad lines of text to a fixed width with a custom character. Pad on the left, right, or both sides. Perfect for formatting fixed-width output. Free — runs entirely in your browser.
Input Text
Padded Output
Related Tools
Markdown → HTML
Convert Markdown to clean HTML instantly. Supports GFM, tables, code blocks, and more.
Case Converter
Convert text to camelCase, PascalCase, snake_case, kebab-case, and more — all at once.
HTML → Markdown
Convert HTML to clean Markdown instantly. Supports headings, links, lists, tables, and code blocks.
Text padding adds characters to the left, right, or both sides of a string to reach a target width. It is a fundamental string manipulation operation used in tabular data alignment, fixed-width file format generation, console output formatting, and any context where strings of varying lengths need to be aligned to a consistent visual column width.
Left-padding (right-aligning the text) is used for numbers in columns — aligning decimal points and units when displaying financial data or statistics. Right-padding (left-aligning the text) is used for text labels in tabular output. Center-padding is used for headings and decorative purposes. The padding character is typically a space, but can be any character: '0' for zero-padded numbers, '-' for ASCII table separators, or '.' for dot-leader tables.
This tool pads a string to a specified target width with configurable alignment (left/right/center) and a custom pad character. It handles multi-line input by padding each line independently to the same target width, making it useful for formatting multi-line tabular data in one operation.
Common Use Cases
Formatting fixed-width command-line output
CLI tools and shell scripts often display tabular information where columns must align. Padding status labels to a fixed width (e.g., 'RUNNING', 'STOPPED', 'PENDING' all padded to 10 characters) ensures columns stay aligned regardless of value length. This is the standard approach for tools like ps, ls -l, and custom monitoring scripts.
Zero-padding numbers in filenames and IDs
File naming conventions for sequential files (frame_001.png, frame_002.png, ...) require zero-padding to ensure alphabetical sorting matches numerical order. Without padding, 'frame_10.png' sorts before 'frame_9.png'. Left-padding numbers with zeros to a fixed width (4 digits: 0001, 0010, 0100) is the standard solution for batch file exports, log rotation, and sequential ID generation.
Generating fixed-width flat file formats
Legacy enterprise systems and financial interchange formats (COBOL-based mainframe outputs, some EDI formats, certain bank file formats) use fixed-width fields where each field occupies an exact number of characters, padded to fill unused positions. Padding fields to their specified widths before concatenating them produces the correctly formatted fixed-width record.
Aligning columns in markdown or text tables
When writing documentation with ASCII or markdown tables, padding cell content to a consistent width makes the source text readable even before rendering. A column of country names padded to 20 characters produces a Markdown table source that looks tabular in a code editor, making it easier to spot missing or misaligned values without rendering the document.
How to Use
- Paste lines of text in the input panel.
- Choose Side: pad on the left, right, or both sides.
- Choose the target Width in characters (20–80).
- Choose the Pad character — space, zero, dot, dash, or asterisk.
- Lines shorter than the target width are padded. Longer lines are unchanged.