It remains a significant challenge to quantitatively describe the corrosion of reinforced concrete (RC) structures under chloride penetration. Moreover, when considering uncertainties throughout the life cycle of corroded RC structures for assessing their safety, reliability, and optimal design, the complexity of the problem intensifies. To address these issues, this paper studies the time-dependent reliability analysis and optimal design of corroded RC beams. At first, the time-dependent reliability of beams is investigated by considering both the serviceability limit state (SLS), which corresponds to the corrosion initiation of the reinforced steel, and the ultimate limit state (ULS), associated with the bending failure of the beam. This analysis takes into account the time-dependent chloride diffusion coefficient and incorporates a stochastic process. The reliability is evaluated using the Monte Carlo Simulation (MCS) method and the cumulative distribution function (CDF) method. Subsequently, a time-dependent reliability-based design optimization (TRBDO) problem is formulated, and the PSO-MCS, a methodology incorporating a particle swarm optimization (PSO) algorithm and MCS is adopted to solve it. After optimization, the initial cost of the specific RC beam is reduced from 1351.879€ to 1247.075€, while the time-dependent reliability within [0, 100] years is improved from 0.6057 to 0.6508. The effectiveness of the CDF, MCS and PSO-MCS methods are demonstrated through reliability analysis and design examples of corroded RC beams.