Modulo

The remainder of dividing one number by another.

Node id math/modulo

The Modulo node outputs the remainder of a / b: 7 modulo 3 is 1. It's useful for repeating patterns, such as alternating every third element.

Inputs

NameTypeDefaultNotes
anumber0
bnumber0

Outputs

NameTypeNotes
resultnumber

Behaviour

  • Sign follows a. Like JavaScript's %, the result has the sign of a: -7 modulo 3 is -1, not 2. Add b to a negative result to get a value from 0 to b.
  • Fractions work. 5.5 modulo 2 is 1.5.
  • Invalid math. Modulo 0 gives NaN, with no error. Both inputs default to 0, so b has to be set.
  • Divide and Floor: the quotient that goes with the remainder.
  • Equals Number: with Modulo, tests whether a number is a multiple of another.
© 2026 Wirepaint