← All tools
// Text

Printf Formatter online

Format strings with C/Python printf-style specifiers (%s, %d, %f, %x) — runs in your browser

Chunky Munster mascot
by
CHUNKY
MUNSTER
// Formatted Output
Output will appear here...
Supported specifiers:  %s (string)  |  %d / %i (integer)  |  %f (float)  |  %.2f (2 decimal places)  |  %e (exponential)  |  %x (hex)  |  %o (octal)  |  %% (literal %)
Width/padding:  %10s (right-align in 10 chars)  |  %-10s (left-align)  |  %05d (zero-pad to 5 digits)

Printf-style formatting is a fundamental string operation used across C, C++, Python (% operator and old-style formatting), Java (String.format), PHP, Ruby, and many other languages. Understanding format specifiers lets you control precisely how numbers, strings, and other values are displayed.

Printf Specifier Reference

Frequently Asked Questions

What does %0.2f mean?

%.2f formats a floating-point number with exactly 2 decimal places. The 0 flag (as in %05.2f) adds zero-padding to reach the specified minimum width. Example: printf('%05.2f', 3.1) → '03.10'.

Does this work with Python format strings?

This tool implements the classic C-style % formatting that is also used in Python's old-style string formatting (e.g. 'Hello %s' % 'World'). Python's newer f-strings and str.format() use different syntax.