Deuteronomy 25:3

Forty stripes he may give him, and not exceed: lest, if he should exceed, and beat him above these with many stripes, then thy brother should seem vile unto thee.

The instruction belongs to the farewell addresses Moses gave just before his death. It stands within the long section from Deuteronomy 5 to 26 that reviews the law for the new generation. That reviewing section is the one from which Deuteronomy takes its name, meaning second law or duplicate of the law. The law limits corporal punishment to forty stripes and forbids going beyond that number. The restraint is imposed so that the punished person is not degraded and made to seem vile.