AE Screens
← Blog

How to Format Numbers in After Effects

Jeremy Wick·

Animating numbers in After Effects is one of those things that should be easy -- but isn't.

Create a Text Layer

Begin with a text layer as the foundation for working with numbers. You can use any placeholder text since expressions will control the actual values.

Add a Number Slider

To animate numbers, apply an expression slider for easy control and keyframing:

Effects > Expression Controls > Slider Control

Link Source Text to Slider

Connect your text layer's Source Text to the slider using the Property Pick Whip. This creates the expression:

effect("Slider Control")("Slider")

The slider now controls the displayed number, though After Effects initially shows excessive precision.

Number Formatting Techniques

Round Numbers

Remove decimals entirely with Math.round():

Math.round(effect("Slider Control")("Slider"))

Rounding numbers in After Effects

Limit Decimal Places

Use .toFixed() for controlled precision:

effect("Slider Control")("Slider").value.toFixed(2)

Adjust the number to display desired decimal places (e.g., "1.00").

Decimal precision in After Effects

Add Thousand Separators

Implement .toLocaleString() for comma formatting:

effect("Slider Control")("Slider").value.toLocaleString()

Important: Ensure your expression engine is set to JavaScript for this function to work.

Thousand separators in After Effects

Advanced Functions

Additional formatting options include:

  • padStart(length, string) -- Prepend characters for fixed-width display ("001")
  • padEnd(length, string) -- Append characters to numbers ("100")
  • String concatenation -- Add prefixes/suffixes ("$100", "100%")

The Num Tool

Creating expressions with inconsistent syntax -- some requiring .value, others .toString() -- can be tedious. Many functions cannot combine (.toFixed() and .toLocaleString() together), making formatting like "$1,000.00" difficult.

Get Num for FREE -- a free After Effects number formatting tool that solves these challenges.