Several therapies have been approved to treat crohn's disease (CD) and ulcerative colitis (UC), indicating that both diseases may share the same molecular subtypes. The aim of this study is to identify shared patient subtypes with common molecular drivers of disease. Five public datasets with 406 CD and 421 UC samples were integrated to identify molecular subtypes. Then, the patient labels from six independent datasets and eight treatment datasets were predicted for validating subtypes and identifying the relationship with response status of corticosteroids, infliximab, vedolizumab, and ustekimumab. Two molecular subtypes were identified from the training datasets, in which CD and UC patients were relatively evenly represented in each subtype. We found six S1-specific gene modules related to innate/adaptive immune responses and tissue remodeling and nine S1-specific cell types (cycling T, Tregs, cd8+ lamina propria, follicular B, cycling B plasma, inflammatory monocytes, inflammatory fibroblast, and post-capillary venules). Subtype S2 was associated with three modules related to metabolism functions and four cell types (immature enterocytes, transit amplifying, immature goblet and WNT5B+). The subtypes can be replicated in six independent datasets based on a 20-gene classifier. Furthermore, response rates to four treatments in subtype S2 were significantly higher than those in subtype S1. This study discovered and validated a robust transcriptome-based molecular classification shared by CD and UC and built a 20-gene classifier. Because two subtypes have different molecular mechanisms and drug response, our classification may aid interpretation of heterogeneous molecular and clinical information in IBD patients.