Abstract The flow in shrouded stator cavities can be quite complex with axial, radial, and circumferential variations. As the leakage flow recirculates and is re-injected into the main flow path upstream of the stator, it deteriorates the near-hub flow field and, thus, degrades the overall aerodynamic performance of the compressor. In addition, the windage heating in the cavity can raise thermal-mechanical concerns. Fully understanding the details of the shrouded-hub cavity flow in a multistage environment can enable better hub cavity designs. In the first part of the paper, the influence of the hub leakage flow on compressor performance and its interactions with the primary flow were investigated. While the impact of hub leakage flow on the primary passage is readily available in the open literature, details inside the cavity geometry are scarce due to the difficulties in instrumenting that region for an experiment or modeling the full cavity geometry. To shed light on this topic, the flow physics in the stator cavity inlet and outlet wells are investigated in this paper using a coupled computational fluid dynamics model with the inclusion of the stator cavity wells for the Purdue 3-stage (P3S) axial compressor, which is representative of the rear stages of a high-pressure-compressor in core engines. At the inlet cavity, the presence of at least one pair of vortices influences the trajectory of the cavity leakage flow. The amount of leakage flow also determines the size of the vortical structures, with larger clearances creating a smaller vortex and vice versa. After passing through the labyrinth seals, the leakage flow travels along the stator landing first and then transitions to the rotor drum. In general, a flow path closer to the rotor drum achieves higher circumferential velocity but also exhibits significant temperature rise. A rise in circumferential velocity directly corresponds to a rise in temperature. In addition, the windage heating increases with increasing seal clearance. Furthermore, the inlet well contributes the most to overall windage, nearly 50% of the total windage heating, while the labyrinth seals and outlet well account for very little.