This paper presents an analytical model to forecast yard inventory in container terminals and proposes a method to determine the optimal space utilization. This method takes into consideration the congestion effects on terminal performance and the seasonal fluctuations and extreme peaks of yard inventory. A total integrated cost minimizing objective function is defined which includes cost for the terminal operator and external costs. Results show that the optimal space utilization for the import area is lower than for the export and transshipment area because the congestion effect on operating cost is higher for imports due to rehandling moves. The perpendicular layout requires more storage space for the same space requirement than the parallel layout but total cost are higher for the parallel layout.