E-commerce packages are notorious for their inefficient usage of space. More than one-quarter volume of a typical e-commerce package comprises air and filler material. The inefficient usage of space significantly reduces the transportation and distribution capacity increasing the operational costs. Therefore, designing an optimal set of packaging box sizes is crucial for improving efficiency. We present the first learning-based framework to determine the optimal packaging box sizes. In particular, we propose a three-stage optimization framework that combines unsupervised learning, reinforcement learning, and tree search to design box sizes. The package optimization problem is formulated into a sequential decision-making task called the box-sizing game. A neural network agent is then designed to play the game and learn heuristic rules to solve the problem. In addition, a tree-search operator is developed to improve the performance of the learned networks. When benchmarked with company-based optimization formulation and two alternate optimization models, we find that our ML-based approach can effectively solve large-scale problems within a stipulated time. We evaluated our model on real-world datasets supplied by a large e-commerce platform. The framework is currently adopted by a large e-commerce company across its 28 fulfillment centers, which is estimated to save the company about 7.1 million USD annually. In addition, it is estimated that paper consumption will be reduced by 2080 metric tons and greenhouse gas emissions by 1960 metric tons annually. The presented optimization framework serves as a decision support tool for designing packaging boxes at large e-commerce warehouses.