This paper aims to segment online consumers based on their attitude toward self-interest and ethical attitudes and explore the impact of these attitudes on the purchasing behavior of agricultural products online in China. The study was conducted using 633 online survey responses from consumers who have purchased agricultural products online in China. First, to validate the relationship between attitude and behavior by structural equation modeling. Next, the number of segments was determined using K-means. Finally, Pearson Chi-square difference tests were performed to analyze demographic and behavioral variables and identify each segment’s characteristics. The results of this study provide a segmentation analysis of the online market for agricultural products in China. The four segments identified are pure ethical consumers, information communicators, brand-quality pursuers, and well-heeled shoppers. Additionally, this study reveals the characteristics of each segment based on demographic and behavioral variables. This study provides a novel approach to segmenting Chinese consumers who purchase agricultural products online based on their attitudes toward self-interest and ethical attitudes, aiming to understand the impact of these attitudes on their purchasing behavior. Moreover, from an ethical consumerism perspective, it explores the effect of ethical information on purchasing agricultural products online, highlighting its significant implications for online marketing strategies.