Patients with gastric ulcers have significantly higher risk of gastric cancer, especially within 2years after diagnosis. We used data from a national database to develop a personalized risk prediction model for patients with peptic ulcer diseases. We collected data from Taiwan's National Health Insurance Research Database on 278,898 patients admitted for the first time with a primary diagnosis of peptic ulcer disease. We used the data to develop a nomogram, which we validated by discrimination and calibration, and in a test cohort. Cumulative incidences of study subjects predicted by the nomogram were examined. In total, 1269 subjects developed gastric cancer. Age, sex, peptic ulcer sites, peptic ulcer complications, Helicobacter pylori eradication, nonsteroidal anti-inflammatory drug use, and surveillance endoscopy were independent factors associated with risk of gastric cancer (all P<.001). The concordance index for the nomogram developed on the basis of these factors was 0.78. Study subjects were divided into quartiles of predicted risk scores; from lowest score quartile to highest, cumulative incidences at 1 year were 7.4/10,000 people, 14.2/10,000 people, 25.5/10,000 people, and 86.6/10,000 people. The cumulative incidences at 2 years were 9.3/10,000 people, 20.9/10,000 people, 38.0/10,000 people, and 135.7/10,000 people for the same quartiles of risk scores. The nomogram was validated in an independent cohort, and similar incidence values were determined. We developed and validated a nomogram to predict risk for gastric cancer 1 and 2 years after diagnosis of peptic ulcer disease. The nomogram provides a prognostic tool that can be easily used for individuals and can help physicians explain risk levels to patients.