Purpose: The importance of four-dimensional-magnetic resonance imaging (4D-MRI) is increasing in guiding online plan adaptation in thoracic and abdominal radiotherapy. Many 4D-MRI sequences are based on multislice two-dimensional (2D) acquisitions which provide contrast flexibility. Intrinsic to MRI, however, are machine-and subject-related geometric image distortions. Full correction of slice-based 4D-MRIs acquired on the Unity MR-linac (Elekta AB, Stockholm, Sweden) is challenging, since through-plane corrections are currently not available for 2D sequences. In this study, we implement a full three-dimensional 3D correction and quantify the geometric and dosimetric effects of machine-related (residual) geometric image distortions. Methods: A commercial three-dimensional (3D) geometric QA phantom (Philips, Best, the Netherlands) was used to quantify the effect of gradient nonlinearity (GNL) and static-field inhomogeneity (B0I) on geometric accuracy. Additionally, the effectiveness of 2D (in-plane, machine-generic), 3D (machine-generic), and in-house developed 3D þ (machine-specific) corrections was investigated. Corrections were based on deformable vector fields derived from spherical harmonics coefficients. Three patients with oligometastases in the liver were scanned with axial 4D-MRIs on our MR-linac (total: 10 imaging sessions). For each patient, a step-and-shoot IMRT plan (3 9 20 Gy) was created based on the simulation mid-position (midP)-CT. The 4D-MRIs were then warped into a daily midP-MRI and geometrically corrected. Next, the treatment plan was adapted according to the position offset of the tumor between midP-CT and the 3D-corrected midP-MRIs. The midP-CT was also deformably registered to the daily midP-MRIs (different corrections applied) to quantify the dosimetric effects of (residual) geometric image distortions. Results: Using phantom data, median GNL distortions were 0.58 mm (no correction), 0.42-0.48 mm (2D), 0.34 mm (3D), and 0.34 mm (3D þ ), measured over a diameter of spherical volume (DSV) of 200 mm. Median B0I distortions were 0.09 mm for the same DSV. For DSVs up to 500 mm, through-plane corrections are necessary to keep the median residual GNL distortion below 1 mm. 3D and 3D þ corrections agreed within 0.15 mm. 2D-corrected images featured uncorrected through-plane distortions of up to 21.11 mm at a distance of 20-25 cm from the machine's isocenter. Based on the 4D-MRI patient scans, the average external body contour distortions were 3.1 mm (uncorrected) and 1.2 mm (2D-corrected), with maximum local distortions of 9.5 mm in the uncorrected images. No (residual) distortions were visible for the metastases, which were all located within 10 cm of the machine's isocenter. The interquartile range (IQR) of dose differences between planned and daily dose caused by variable patient setup, patient anatomy, and online plan adaptation was 1.37 Gy/Fx for the PTV D95%. When comparing dose on 3D-corrected with uncorrected (2D-corrected) images, the IQR was 0.61 (0.31) Gy/Fx. Conclusions: GNL is the ma...