Skip to tool
FeuTex · free tools runs in-browser no bloat built by LiMiT

Percentage Formatter (Python)

Paste a number and get a clean percentage string plus copy-ready Python examples (f-strings, format(), pandas, and matplotlib). Works for both fractional inputs (0–1) and percent inputs (0–100).

Category: Finance · URL: /tools/percentage-formatter-python.html
Privacy: runs locally in your browser. No uploads, no tracking scripts.

How to use

Use the formatter to generate the exact percent string you need and the matching Python snippet.

  1. Enter a number (e.g., 0.1234 or 12.34).
  2. Choose whether your input is a fraction (0–1) or a percent (0–100).
  3. Set decimals and options (trim zeros, commas, plus sign, parentheses for negatives).
  4. Click Format and copy the output/snippets.
Keywords this page targets (natural cluster): percentage formatter python, python format percent, python percent format specifier, python f string percent, python format to percentage, python convert decimal to percent string, python percent with 2 decimals, python percent rounding, python percent with comma separator, python show plus sign percent, python parentheses negative percent, python strip trailing zeros percent, python format percentage pandas, python percent formatter matplotlib, python format percent from 0-100, python format percent from 0-1, python percent string from float, python percent format Decimal, python percent display in reports, python percent format locale, python percent formatter tick labels
Secondary intents covered: Format a float like 0.1234 as 12.34% in Python, Handle inputs that are already in percent (e.g., 12.34 means 12.34%), Control rounding and number of decimal places for percentages, Add thousand separators and/or a leading plus sign, Use parentheses for negative percentages in finance-style reporting, Generate reusable Python snippets for f-strings and format(), Format pandas columns as percentages for display/export, Format matplotlib axis ticks as percentages

FAQ

In Python, does the % format expect 0–1 or 0–100?

It expects a fraction (0–1). For example, 0.1234 becomes 12.34%; if you have 12.34, divide by 100 first.

What is the simplest way to format a percentage with 2 decimals?

Use an f-string: f"{x:.2%}" where x is a fraction.

How do I add thousand separators to percentages in Python?

Use the comma option in the spec: f"{x:,.2%}". This matters for large values (e.g., 12.3456 → 1,234.56%).

How can I show a plus sign for positive percentages?

Add + to the format spec: f"{x:+.2%}".

How do I use parentheses for negative percentages?

Python’s percent formatting doesn’t include parentheses by default; format normally and wrap negatives (e.g., if string starts with -, replace with (...)).

How do I format a pandas column as percentages?

Use map: df['pct_str'] = df['pct'].map('{:.2%}'.format). If your column is 0–100, do df['pct']=df['pct']/100 first.

How do I format matplotlib axis ticks as percentages?

Use matplotlib.ticker.PercentFormatter, typically with fractional data: ax.yaxis.set_major_formatter(mticker.PercentFormatter(xmax=1, decimals=2)).