Fully automated at-line terahertz time-domain spectroscopy in transmission mode is used to measure tablet porosity for thousands of immediate release tablets. The measurements are rapid and non-destructive. Both laboratory prepared tablets and commercial samples are studied. Multiple measurements on individual tablets quantify the random errors in the terahertz results. These show that the measurements of refractive index are precise, with the standard deviation on a single tablet being about 0.002, with variation between measurements being due to small errors in thickness measurement and from the resolution of the instrument. Six batches of 1000 tablets each were directly compressed using a rotary press. The tabletting turret speed (10 and 30 rpm) and compaction pressure (50, 100 and 200 MPa) were varied between the batches. As expected, the tablets compacted at the highest pressure have far lower porosity than those compacted at the lowest pressure. The turret rotation speed also has a significant effect on porosity. This variation in process parameters resulted in batches of tablets with an average porosity between 5.5 and 26.5%. Within each batch, there is a distribution of porosity values, the standard deviation of which is in the range 1.1 to 1.9%. Destructive measurements of disintegration time were performed in order to develop a predictive model correlating disintegration time and tablet porosity. Testing of the model suggested it was reasonable though there may be some small systematic errors in disintegration time measurement. The terahertz measurements further showed that there are changes in tablet properties after storage for nine months in ambient conditions.