Objective To evaluate the equity of health care resource allocation in Shanghai and the trend of change from 1995 to 2018.Methods Being based on the Gini coefficient and the Theil index, the equity of health care resource allocation in Shanghai from 1995 to 2018 was comprehensively evaluated from the perspective of "demographic equity" and "geographic equity", and the Mann-Kendall non-parametric test was used to predict the trend of changes.Results The Gini coefficient of the distribution of medical and health resources by population in Shanghai from 1995 to 2018 was 0.225 9 to 0.411 9, and the configuration was in a normal or optimal state with an increasing trend. The Gini coefficient distributed by geographic area was 0.892 4 to 0.979 3, which was in a dangerous state and in a decreasing trend. The overall Theil index ranged from 0.010 9 to 0.058 1, which was a more equitable configuration, but with a decreasing trend. In addition, both the Gini coefficient and the Theil index showed that equity improvements were mainly influenced by the number of health facilities and beds, with health facilities contributing the most to equity, while the disparity in health technician staffs was the main reason for the decline in equity. Inequities in the allocation of health facilities and number of beds originated mainly within regions, while inequities in the allocation of health technicians originated mainly between regions.Conclusion The allocation of health care resources in Shanghai is more equitable and the equity has been on the rise in recent years. However, at the present stage, there is still a contradiction between equitable allocation by population and inequitable allocation by geographic area, and in the future, there is a contradiction between the tendency of inequitable allocation by population and the tendency of equitable allocation by geographic area. Optimizing the allocation of health technicians is the key to improving equity, and addressing regional differences in allocation is an effective way to optimize the allocation of health technicians.