Search Ctrl K
Home / Tools
THE FEUTEX TOOLKIT

Percentage Formatter (Python)

Format numbers as percentages in Python. Convert fraction↔percent, choose decimals, commas, plus sign, parentheses for negatives, and copy ready-to-use Python snippets (f-strings, format(), pandas, matplotlib).

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.

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)).

Continue your workflow

Browse related tools by task. Use the improved core tools for a consistent workspace with file import, downloads and clear validation errors.