Legally saying, once you get off payroll system, you loss your H1B status the same day, no grace period, however, here is some suggestion may be helpful:
1. you need to find a job ASAP;
2. When the new employer file H1B for you, it need a most recent paycheck stub to show CIS that you are in H1B status, But
3. Sometime (most time) CIS ignore 1~3 months gap of the submited paycheck stub date and the filing date, that means you may have upto 3 months to look for a job and get new H1B petition filed;
4. All the timeline above must be before the expiration date of your current H1B.
If you have spouse and your spouse is not a dependent to you, you may also consider to be a dependent to your spouse, that way will keep you legal.