Maritime shipping, an integral component of global trade, accounts for nearly 3% of global carbon dioxide emissions and faces significant challenges in mitigating its carbon footprints. This study addresses the shortcomings of current carbon emission surcharges levied by shipping companies and the deficiencies of allocation methods utilized by the government, such as the inequity of uniform carbon emission charges across diverse origin–destination (od) pairs and the reliance on potentially inaccurate self-reported emissions data to assign carbon emission allowances. We propose a novel approach to carbon emission allocation per twenty-foot equivalent unit (TEU) container per od pair in liner shipping from the perspective of the government, aiming to enhance government oversight and minimize social costs. Leveraging a bi-level programming model, our research navigates the complex interplay between government regulatory objectives and shipping companies’ operational decisions, identifying a socially optimal carbon allocation policy. Our approach introduces three innovative carbon allocation methods that advance beyond the traditional metric that typically focuses solely on emissions and cargo volume. Our first two innovative methods integrate shipping distances into the carbon allocation process, specifically considering both the actual traveling distance and the shortest sailing distance. Furthermore, we propose the third innovative “harmonic distance,” which is a convex combination of the actual traveling distance and the shortest sailing distance. This measure effectively reflects both the operational realities and equity concerns associated with shipping services. Our findings reveal the effectiveness of utilizing the shortest sailing distance for carbon allocation per TEU per od pair, offering a straightforward, route-independent, and equitable solution. This approach diverges from current industrial practices, favoring a fairer emission allocation basis and balancing the interests of governments, shipping companies, and consumers. Through comprehensive experiments, we demonstrate the superiority of this method in minimizing total social costs and providing a viable path toward environmental sustainability and economic efficiency in liner shipping.