The minimax problem in continuous high-dimensional spaces has been a challenge in optimization. Traditional optimization algorithms cannot balance well between depth search and breadth search in high dimensional search spaces. A new hermit crab optimization algorithm (HCOA) is introduced in this paper to address these problems. Inspired by the population behavior of hermit crabs, the hermit crab optimization algorithm introduces the optimal crab memory and the backtracking search around the memory. Compared with other metaheuristic algorithms, the hermit crab optimization algorithm does not require advanced training or parameter correction and thus can be more quickly employed for different optimization problems. To explore the capabilities of HCOA, the simulation experiment selected CEC2017 as the test function and five well-known optimization algorithms as the control group. Among the 29 benchmark features in the CEC2017, HCAO ranks first in the number of features with 23, and second, third and fifth with two each. Experimental results demonstrate that HCOA present highly accurate and robust results for high-dimensional optimization problems.