PurposeThe purpose of this paper is to conduct a numerical study of the effect of magnetic field on thermocapillary convection of a two layered system of Newtonian fluids, confined in a rectangular cavity. The flow within the cavity is subject to the horizontal temperature gradient. Attention is focused on how the heat transfer and flow properties are affected subject to the applied magnetic field, particularly in the lower layer. For this purpose, the fluid combinations of di‐Boron Trioxide (B2O3) over Gallium Arsenide GaAs (III‐V), and Silicon oil 10 cSt over Fluorinert FC 70 are considered in the present study.Design/methodology/approachThe non‐linear two‐dimensional vorticity transport equations along with the energy equations are solved for the two liquid layers using the Alternate Direct Implicit method, whereas the elliptic partial differential equations of the stream function are solved using the Successive Over Relaxation method.FindingsIt was found that despite the significant reduction of flow in the two layers, the number of cells in the lower layer increases with the increase in Hartmann number Ha. However, the flow intensity decreases with the increase in Hartmann number. This decrease is more pronounced in the lower layer, as compared to the upper layer. The numerical scheme employed for the solution is found to be in good agreement with the previous work.Research limitations/implicationsThe analysis is made for two layer liquid system with undeformable interface and free surface. The detailed study of the effect of magnetic field on oscillatory Marangoni convection in two layer system with deformable interface is left for future work.Practical implicationsThe approach is useful in optimizing the flow properties of the fluids in a two layer system, particularly the lower layer, to yield the results of potential practical interest.Originality/valueThe results of the study may be of some interest to researchers in the field of semiconductor technology, as the melt control is intensively investigated for the development in the manufacture of defect‐free semiconductors and crystals.