Calculating overtime pay accurately is essential whether you are building a payroll tool, tracking hourly work, or checking your own paycheck. Here is a quick breakdown of standard overtime formulas along with a simple JavaScript implementation.
Standard Overtime Pay Formulas
Regular Pay: Regular Hours × Hourly Rate
Time and a Half (1.5x): Overtime Hours × (Hourly Rate × 1.5)
Double Time (2x): Double-Time Hours × (Hourly Rate × 2)
Quick Example
If someone earns $20/hour, works 40 regular hours, and puts in 6 overtime hours at 1.5x:
Regular Pay = 40 × $20 = $800
Overtime Pay = 6 × ($20 × 1.5) = $180
Total Pay = $980
JavaScript Function Example
JavaScript
function calculateOvertimePay(hourlyRate, regularHours, overtimeHours, doubleTimeHours = 0) {
const regularPay = hourlyRate * regularHours;
const timeAndAHalfPay = hourlyRate * 1.5 * overtimeHours;
const doubleTimePay = hourlyRate * 2 * doubleTimeHours;
return {
regularPay,
timeAndAHalfPay,
doubleTimePay,
totalPay: regularPay + timeAndAHalfPay + doubleTimePay
};
}
Free Online Tool
If you want to quickly test different hourly rates, time-and-a-half, or double-time scenarios without writing code, you can try OT Calculator.