Skip to tool

SQL Pad string Online

Pad text left/right/both to a target width.

The output updates as you type. The tool processes input in your browser.

Worked example

Width is a minimum size. The tool preserves longer strings and applies the fill to the selected side. Use PostgreSQL’s function reference to adapt the input to SQL syntax.

Pad length
8
Pad string
"0"
Pad type
"STR_PAD_LEFT"
Sample input
42
Sample output
00000042

Using this operation in SQL

The interactive result uses JavaScript. Check the database dialect. PostgreSQL text functions use SQL-style one-based positions and LIKE uses its own pattern syntax.

SQL reference