The three-dimensional (3D) structure and stability of DNA are essential to understand/control their biological functions and aid the development of novel materials. In this work, we present a coarse-grained (CG) model for DNA based on the RNA CG model proposed by us, to predict 3D structures and stability for both dsDNA and ssDNA from the sequence. Combined with a Monte Carlo simulated annealing algorithm and CG force fields involving the sequence-dependent base-pairing/stacking interactions and an implicit electrostatic potential, the present model successfully folds 20 dsDNAs (≤52nt) and 20 ssDNAs (≤74nt) into the corresponding native-like structures just from their sequences, with an overall mean RMSD of 3.4Å from the experimental structures. For DNAs with various lengths and sequences, the present model can make reliable predictions on stability, e.g., for 27 dsDNAs with/without bulge/internal loops and 24 ssDNAs including pseudoknot, the mean deviation of predicted melting temperatures from the corresponding experimental data is only ~2.0℃. Furthermore, the model also quantificationally predicts the effects of monovalent or divalent ions on the structure stability of ssDNAs/dsDNAs.Author SummaryTo determine 3D structures and quantify stability of single- (ss) and double-stranded (ds) DNAs is essential to unveil the mechanisms of their functions and to further guide the production and development of novel materials. Although many DNA models have been proposed to reproduce the basic structural, mechanical, or thermodynamic properties of dsDNAs based on the secondary structure information or preset constraints, there are very few models can be used to investigate the ssDNA folding or dsDNA assembly from the sequence. Furthermore, due to the polyanionic nature of DNAs, metal ions (e.g., Na+ and Mg2+) in solutions can play an essential role in DNA folding and dynamics. Nevertheless, ab initio predictions for DNA folding in ion solutions are still an unresolved problem. In this work, we developed a novel coarse-grained model to predict 3D structures and thermodynamic stabilities for both ssDNAs and dsDNAs in monovalent/divalent ion solutions from their sequences. As compared with the extensive experimental data and available existing models, we showed that the present model can successfully fold simple DNAs into their native-like structures, and can also accurately reproduce the effects of sequence and monovalent/divalent ions on structure stability for ssDNAs including pseudoknot and dsDNAs with/without bulge/internal loops.