it depends most are the same just remember every 3 years toyota changed something in the truck. best thing is a tape measure. measure yours first and then go from there. the only way you will know is trial and error. plus it aint hard to changed out a driveshaft.
If you're considering swapping for some reason, length doesn't matter. The 2WD shaft has a slip-yoke at the tranny end while the 4WD shaft has a flange that bolts to the t-case.