Although molecular simulation methods have yielded valuable insights into mechanistic aspects of protein refolding in vitro, they have up to now not been used to model the folding of proteins as they are actually synthesized by the ribosome. To address this issue, we report here simulation studies of three model proteins: chymotrypsin inhibitor 2 (CI2), barnase, and Semliki forest virus protein (SFVP), and directly compare their folding during ribosome-mediated synthesis with their refolding from random, denatured conformations. To calibrate the methodology, simulations are first compared with in vitro data on the folding stabilities of N-terminal fragments of CI2 and barnase; the simulations reproduce the fact that both the stability and thermal folding cooperativity increase as fragments increase in length. Coupled simulations of synthesis and folding for the same two proteins are then described, showing that both fold essentially post-translationally, with mechanisms effectively identical to those for refolding. In both cases, confinement of the nascent polypeptide chain within the ribosome tunnel does not appear to promote significant formation of native structure during synthesis; there are however clear indications that the formation of structure within the nascent chain is sensitive to location within the ribosome tunnel, being subject to both gain and loss as the chain lengthens. Interestingly, simulations in which CI2 is artificially stabilized show a pronounced tendency to become trapped within the tunnel in partially folded conformations: non-cooperative folding, therefore, appears in the simulations to exert a detrimental effect on the rate at which fully folded conformations are formed. Finally, simulations of the two-domain protease module of SFVP, which experimentally folds cotranslationally, indicate that for multi-domain proteins, ribosome-mediated folding may follow different pathways from those taken during refolding. Taken together, these studies provide a first step toward developing more realistic methods for simulating protein folding as it occurs in vivo.