It's six years in total, excluding time spent outside the US. The status is valid for at most three calendar years, but it can be shorter for fixed-term positions. And you can renew it as long as your total time in the US is less than 6 years.
I was on H-1B at a university where researcher appointments were nominally from July of year N to June of year N+2. But if you didn't start in July, your second appointment might be only 1 year, for some bureaucratic reasons. And you had to renew the H-1B for each appointment. I had five H-1Bs in total over ~7 years.
I was on H-1B at a university where researcher appointments were nominally from July of year N to June of year N+2. But if you didn't start in July, your second appointment might be only 1 year, for some bureaucratic reasons. And you had to renew the H-1B for each appointment. I had five H-1Bs in total over ~7 years.