Purpose Pregnancies ending before gestational week 12 are common but not notified to the Medical Birth Registry of Norway. Our goal was to develop an algorithm that more completely detects and dates pregnancy outcomes by using diagnostic codes from primary and secondary care registries to complement information from the birth registry. Methods We used nationwide linked registry data between 2008 and 2018 in a hierarchical manner: We developed an algorithm to arrive at unique pregnancy outcomes, considering codes within 56 days as the same event. To infer gestational age of pregnancy outcomes before gestational week 12, we used the median gestational week of pregnancy markers (45 ICD-10 codes and 9 ICPC-2 codes). When no pregnancy markers were available, we assigned outcome-specific gestational age estimates. The performance of the algorithm was assessed by blinded clinicians. Results Using only the medical birth registry, we identified 649,703 pregnancies, including 1,369 (0.2%) miscarriages and 3,058 (0.5%) elective terminations. With the new algorithm, we detected 859,449 pregnancies, including 642,712 live-births (74.8%), 112,257 miscarriages (13.1%), 94,664 elective terminations (11.0%), 6,429 ectopic pregnancies (0.7%), 2,564 stillbirths (0.3%), and 823 molar pregnancies (0.1%). The median gestational age was 10 +0 weeks (IQR 10 +0-11 +3) for miscarriages and 8 +0 weeks (IQR 8 +0-9 +6) for elective terminations. Gestational age could be inferred using pregnancy markers for 66.3% of miscarriages and 47.2% of elective terminations. Conclusion The pregnancy algorithm improved the detection and dating of early non-live pregnancy outcomes that would have gone unnoticed if relying solely on the medical birth registry information.