This paper studied the stack effect in courtyards in buildings through the pressure difference between the top and the bottom in the courtyard through three-dimensional (3D) numerical simulations, which would provide engineering guidance for the fire protection design of courtyards in buildings. During the fire, the stronger the stack effect was, the pressure difference between the top and the bottom was more significant, the fire smoke reached the top of the courtyard more quickly, and the temperature and the smoke concentration at the top were influenced in a shorter time. The influence of the size of the courtyard in the stack effect was investigated. It was found that the stack effect was linearly negatively related to the width of the cross section W and the length of the cross section L, exponentially negatively related with the area of the cross section A, while it was exponentially positively related to the height of the courtyard H. The change in the walls without windows (W) affected ΔPmax and the stack effect more significantly compared with the change in walls with windows (L). When L/W ≤ 1, the stack effect was strengthened as L/W increased; when L/W > 1, the stack effect was weakened as L/W increased. The stack effect was the most significant when L/W = 1.