In this study, the entropy generation for steady, compressible gas flow inside two-dimensional rectangular microchannel at slip flow regime with constant walls temperature under the influence of magnetic field was analytically investigated. The obtained velocity and temperature distributions were used in this study. The influences of changing several parameters, such as, Knudsen number, Brinkman number, Hartmann number, aspect ratio, electric field to magnetic field ratio and pressure ratio were investigated. A finite volume method was used for numerical validation. The obtained results showed that the total entropy generation decreases in the direction toward the wall of the microchannel and increases along the flow direction. The total entropy generation increases as Knudsen number, aspect ratio, electric to magnetic field ratio, pressure ratio and Brinkman number increases. Entropy generation due to the magnetic field effect had the maximum value except the region near the walls of the microchannel. Entropy generation due to the friction effect was low along the centreline and increase toward the walls, while entropy generation due to the heat transfer effect was very low as compared to the friction effect and magnetic effect.