The digital economy is developing rapidly worldwide, which is of great strategic significance in leading and driving the process of high-quality and high-efficiency development of the economy. It has gradually become a new engine to promote China’s economic growth. Therefore, it is vital to establish a digital economy indicator system. In this context, according to the connotation of digital economy, comprehensively consider the four dimensions of digital foundation, digital application, digital innovation and digital benefit, and build a full-scale digital economy indicator system. However, some previous literature proposed operating the K-means clustering algorithm in optimizing the index system. The algorithm, susceptible to the initial selection of cluster center, generates completely different clustering results with other random seed points and is thus unsuitable for optimizing the index system. Based on this, the advantages of GRA, SA, and K-means algorithms are combined to propose a K-means-SA algorithm that can obtain the global optimal solution. Then, by combining the K-means SA algorithm and the rough set algorithm, the constructed index system is further optimized. Ultimately, it establishes a set of all-round, multi-system and multi-dimensional digital economy index systems, which is of great reference significance for formulating relevant policies, provides scientific index support for the subsequent extension of digital economy theory, and promotes the benign growth of the worldwide economy.