To pad a string to length, add a repeating pattern until a shorter source reaches the exact Unicode code-point target; text that already meets or exceeds that target is left unchanged.
String padding is useful when a plain-text label, simple identifier, test fixture, or aligned text field must meet a declared text length without rewriting the source. The important distinction is that a code-point target is not a byte count or a screen-width measurement. The Text Padder uses that code-point model, accepts a custom repeating pattern, and never truncates source text to force a shorter result.

What string padding changes
Padding adds characters around or after existing text; it does not split words, reorder characters, or normalize whitespace. When the source is shorter than the target, the number of additions is target length − current code-point length. The selected pattern repeats from its first code point and stops exactly when the missing count is reached, so the final repetition can be partial.
- Source text: Remains intact inside the padded output.
- Padding pattern: Can contain one or several Unicode code points, with a partial repetition at the end when necessary.
- Target: Determines how many code points must be added to a shorter source.
- Result: Is deterministic for the same accepted source, target, pattern, and side.
Keep one distinction in mind: the target is exact for a source that needs padding, but it is not a truncation target. A source that is already long enough is returned unchanged.
Choosing left, right, or both
The side setting controls where the new code points appear. It does not change the length unit or make the result match a rendered display width.
| Placement | Where the added text goes | Typical reason to choose it |
|---|---|---|
| Right | After the source, keeping the source at the beginning | Suffix-style labels or records that begin with the original text |
| Left | Before the source, keeping the source at the end | Right-aligned-looking identifiers or numeric labels |
| Both | Between the two edges of the source | Balanced plain-text labels or decorative padding on both sides |
For both-side padding, the missing count is divided evenly between the edges. If one code point remains unassigned, it goes on the right, so the left side never receives the larger share. The repeated sequence starts with the pattern’s first code point and is cut exactly at the total number of additions required. No extra complete pattern is appended beyond the target.
Use right padding when the source should remain at the beginning, left padding when it should remain at the end, and both-side padding when space is wanted on either side. These are text-placement rules, not guarantees about terminal columns, font rendering, or optical alignment.
Pad a string to an exact length
- Enter the source text and target. Paste the original text into the source field and enter a whole-number target from 0 through 1,000,000. The target is measured in Unicode code points.
- Choose the pattern and side. Enter a nonempty padding pattern, which may contain one character or several, and select left, right, or both sides.
- Pad and verify. Run the padding action, then check the reported output length and review the complete preview. If the source was shorter, the padded result should have the requested length.
- Download when needed. If the preview is correct, download the result as a UTF-8 TXT file. The original source remains in the editor for comparison.
Spaces, line breaks, punctuation, emoji, and multi-character patterns are accepted as ordinary padding text. Because invisible characters can be difficult to inspect, use the reported length together with the preview rather than judging only by appearance.
Follow one complete padding example
Suppose the source is cat, the target is eight code points, the pattern is -_, and padding is placed on both sides.
- Current source length: 3 code points.
- Required additions: 8 − 3 = 5 code points.
- Five code points taken from the repeating pattern: -_-_-
- Both-side split: The left receives 2 code points, and the right receives the remaining 3.
- Final padded output: -_cat-_-
The left contribution is the first two characters of the pattern sequence, the source remains unchanged in the middle, and the right contribution contains the remaining three. The result stops at the requested length instead of appending another complete copy of the pattern.
Why code-point length differs from other lengths
The target uses JavaScript string iteration, which counts Unicode code points rather than UTF-16 code units. The JavaScript string iterator reference explains this iteration model. A standalone emoji represented by one code point normally counts as one, while a combining mark counts separately from its base character and a multi-code-point emoji sequence can count as several. The result therefore matches a declared code-point specification, not necessarily the number of symbols a person sees.
| Length model | What it measures | Matches the Text Padder target? |
|---|---|---|
| Unicode code points | Each Unicode code point in the text | Yes |
| UTF-16 code units | The units used to represent a JavaScript string | No |
| Encoded bytes | The size of the text after encoding, such as UTF-8 | No |
| Grapheme clusters | User-perceived character groups | No |
| Display columns | The width assigned by a terminal or rendered interface | No |
Tabs, East Asian wide characters, emoji, combining sequences, and proportional fonts can occupy widths that do not match their code-point count. The output is also not byte padding for a binary protocol, database column, cryptographic block, or encoded file. UTF-8 characters can use different numbers of bytes, so a code-point target cannot guarantee a byte target. Use a format-aware byte utility when a specification defines storage length instead of text length.
Validation and no-truncation rules
The target and input rules determine whether padding can run and what the result will contain.
- Target validation: The target must be a non-negative whole number. Decimal, negative, missing, and nonnumeric values are rejected.
- Longer source: Text that already meets or exceeds the target is returned unchanged. The tool never truncates it to reach a shorter target.
- Zero target: A target of zero is valid, but nonempty source text remains unchanged under the same no-truncation rule.
- Empty pattern: The padding pattern must not be empty when characters need to be added. Any nonempty visitor-supplied pattern is allowed.
- Maximum size: The target cannot exceed 1,000,000 code points. Source text longer than that ceiling is not expanded.
The one-million-code-point ceiling also bounds memory use, repeated concatenation, preview rendering, and download creation. Because the operation is deterministic, the same accepted source, target, pattern, and side always produce the same string.
Previewing, downloading, and local processing
Review the complete output before downloading or reusing it. Leading and trailing spaces, tabs, line breaks, and other invisible characters are still real text. The original remains available in the editor, and changing any field clears the previous result so that an outdated preview cannot be mistaken for the current settings.
The padding operation stays inside the current browser tab, and the text is not uploaded to Lizely. Padding, previewing, and TXT download creation use local browser processing without a network request, random source, or external dataset.
When the download button is clicked, the tool creates a temporary Blob URL, starts the browser download, and schedules immediate revocation of that URL. The MDN Blob documentation describes the browser object used to represent the file data. The downloaded TXT file is encoded as UTF-8.
When code-point padding is appropriate
Code-point padding is a good fit for fixed-width plain-text labels, simple identifiers, test fixtures, aligned text fields, display mockups, and consistent borders around short strings. It works especially well when the governing format explicitly defines text length in Unicode code points and the text is later processed by another system that uses the same measurement model.
It is not the right choice when the real requirement is encoded byte size, terminal display width, rendered column width, or a specific visual font metric. In those cases, calculate the required value according to the relevant format or use a layout-aware method instead of assuming that a matching code-point count will align the output.
- Confirm that the source is shorter than the target when padding is expected.
- Check the reported output length after the preview is generated.
- Inspect both edges for spaces, line breaks, and other subtle characters.
- Use a separate byte or display-width workflow when the specification measures something other than code points.
For a deeper look, see Text Pattern Generator Cheat Sheet: Rules and Limits.