A digital controller for controlling the operation of a folding machine enables automatic folding of a desired number of sheets responsive to entry of that number into a selector. The controller includes three decade counter stages for corresponding rows of units, tens and hundreds push buttons. Each stage including a decimal-to-BCD encoder, a buffer register, and a digital or binary counter. The BCD representation of the selected count for each digit is loaded into the respective decade down counters. Pulses generated by a sensor and associated circuitry are used to decrease the count in the decade counters. When the content of the decade counter reaches either 0 or 1, a solenoid control valve is actuated which interrupts operation of the machine. A repeat switch, when actuated, prevents clearing of the buffer registers so that multiple groups of the same number of sheets can be folded without reentering the number into the selector