While rail transport is growing for medium-distance journeys, the first and last miles are travelled by road, marking a change of transport mode in inland terminals (ITs). Moreover, the introduction of ITs in seaport hinterlands is increasing with a view to decongesting ports, and the best transport mode to connect these ITs with ports is that of rail.In 2013, chemicals were involved in 48 rail accidents in the EU-28 and in 667 in the United States (US). An appropriate design for the layout of inland terminals for containers with dangerous goods (ITDGs) involved in the rail system will increase the safety and operability of rail transport, avoiding accidents such as Tianjin (2015).The novelty of this work is a methodology to design the layout of ITDGs involved in rail transport through a hierarchy of container handling equipment (CHE), used in the yard of the terminal for a safer, more resilient and more environmentally friendly rail transport.The AHP (analytic hierarchy process) was used to hierarchize five alternative layouts, one for each CHE used in the yard; and according to criteria belonging to three areas: safety and security, environment and equipment performance. Results show that a layout linked to platforms is the preferred alternative for storing containers with dangerous goods (DGs) in ITs connected to railways.The implementation of this methodology will reduce consequences in the case of a serious accident in, or terrorist attack on, ITDGs involved in the rail system and GHG (greenhouse gas) emissions in the terminal. a key role in diminishing the pressure on the inland segment of freight distribution. This will reduce traffic, risk, and associated environmental impacts in regions surrounding ports and may become a relevant element of the supply chain. This is especially true due to the high costs for companies and legal requirements involved in seaport facilities. The mode of transport (road, barge or rail) used to access the hinterland from the seaport will depend on the distance between them, their availability, the costs and the quality of the service (e.g. transit times). The use of rail transport, from a cost perspective, is the most competitive in distant terminals (more than 300 km). However, rail has also been used for close (less than 100 km) and mid-range terminals to