In this paper we describe how to swap two 2 × 2 blocks in a real Schur form and a generalized real Schur form. We pay special attention to the numerical stability of the method. We also illustrate the stability of our approach by a series of numerical tests.