Two-dimensional simulations based on the isothermal lattice-Boltzmann method have been undertaken on microchannels with a sudden expansion or contraction. The study provides insight into the analysis of flows in complicated microdevices. The flow is pressure driven, and computations are performed for several Knudsen numbers, and area and pressure ratios, allowing the effects of compressibility and rarefaction to be assessed. The pressure drop for both the converging and diverging channels shows a discontinuity in slope at the junction, and is accompanied by a jump in velocity. The pressure drop in each section can be predicted well by the theory for straight channels. The mass flow ratio between converging and diverging channels is close to unity, and the streamlines are attached in both cases. It is deduced that compressibility and rarefaction have opposite effects on the flow. These results suggest that complex channels of the type considered here can be understood in terms of their primary units, and they experience only small secondary losses.