In this paper, a genetic algorithm is applied to optimize the dimensions of cold-formed Z-shape purlins continuous over two spans under gravity load. The optimization criterion is to maximize the load resistance per cross-section and the design variables are chosen from the discrete values based on the manufacturing requirements. Purlins are designed in accordance with Eurocode 3, Part 1.3. In addition, the modified Eurocode 3 method, in which the elastic local buckling stress and distortional buckling stress calculated using Finite Strip Method (FSM) are integrated into the design process, is used to determine the effective section properties. The results are compared with those obtained using Eurocode 3 method