The Shanxi merchants were one of the top ten merchant groups in Chinese history. From the Ming and Qing Dynasties to the Republic of China, they contributed significantly to the prosperity of China’s financial industry while also developing traditional residences adapted to the local living environment. Nevertheless, current research lacks a thorough investigation into how Shanxi merchant culture influenced the spatial forms of these residences. This study aimed to analyze the spatial forms of three types of Shanxi merchant residences in Pingyao Ancient City through a case study approach, exploring the factors influencing their spatial forms and their relationship with local culture. The focus is on how the shop residence, workshop residence, and courtyard residence types reflect the interplay between commercial activities and the sociocultural background through their spatial arrangements. The findings indicate a high degree of integration between commercial and residential functions, highlighting the profound impact of Shanxi merchant culture on social hierarchy and family structure. This research provides new insights into the spatial forms of Shanxi merchant residences, offering implications for the adaptive reuse of residences in modern urban planning and architectural design, as well as providing a theoretical basis and reference for the preservation and regeneration of architectural heritage.