Course length is set by each state. Online, you choose when to do it.
It depends on your state
Florida's Basic Driver Improvement course is 4 hours. Texas driving safety courses include at least 6 hours of instruction. New York's PIRP course is 6 hours (the NY DMV requires at least 320 minutes of instruction).
You can stop and start
Online courses save your progress. You can do a lesson on your lunch break and finish at night. Many people split it over a day or two.
Plan around your deadline
In Florida, the clerk gives you a date to finish. In Texas, the court sets your deadline. Start early, so you have time for your certificate and any documents the court needs. See how it works.
Tips to finish faster
Use a laptop or a phone with a good connection, keep your driver license handy for identity checks, and read each section once carefully rather than rushing. The final exam is easier when you do.