Elephant herding optimization (EHO) algorithm which is a new swarm intelligence optimization algorithm was proposed in 2015. Its cores are clan updating operator and separation operator. Although EHO has achieved great success, there are still some shortcomings. For example, EHO generates clans with a fixed number of individuals. The separation operator is only applied to the worst individual of each clan, easily leading to low diversity of the population. In order to improve the performance of EHO, in this paper, we improved EHO and proposed an opposition-based learning (OBL) elephant herding optimization (OBLEHO) algorithm. First, we introduced the OBL strategy into the process of initialization and clan leader updating. Second, we used K-Means clustering to classify individuals with similar positions into the same clan and improved the clan updating operator. Third, we increased the number of separated individuals and introduced the Cauchy mutation operator. Finally, we applied an elitist strategy to the proposed algorithm. Subsequently, we used 29 benchmark functions of CEC 2017 and 5 sets of traveling salesman problem (TSP) to verify the performance of OBLEHO. The experimental results indicated that OBLEHO has great competitiveness in terms of benchmark functions and TSP.