Purpose: To evaluate the impact of an air gap on the Magic Plate (MP512) response and optimize this gap for relative dosimetry in photon and electron beams. Materials and methods: MP512 is a 2D monolithic silicon detector manufactured on a p-Type substrate. The array consists of 512 pixels with 0.5 x 0.5 mm2 size and 2 mm pitch with an overall dimension of 52 x 52 mm2. The signal ratio (SR) as a function of beam size and the percentage were measured with MP512 in 6 MV and 10 MV photon beams. The enhanced dynamic wedge (EDW) beam profile measurements were performed for 6 MV photon beams. In this work the signal ratio is defined as the ratio of central axis MP512 reading for field sizes ranging from 0.5 x 0.5 cm2 to 10 x 10 cm2 and for the reference square field of side 10 cm at a depth of 10 cm in solid water phantom. The measurements were performed with an air gap immediately above the detector array of 0.5, 1.0, 1.2, 2.0 and 2.6 mm, respectively. The PDD was measured for field sizes 2x 2 cm2, 5x 5 cm2 and 10x 10 cm2 by scanning the MP512 from the depth of 0.5 cm to 10 cm. The beam profiles were measured for Varian linac enhanced dynamic wedge (EDW) angles of 15, 45 and 60 for field size 5x 5 cm2. The PDD for 6, 12 and 20 MeV electron beams were performed for a standard applicator providing 10x 10 cm2 field size. Results: The signal ratio measured with MP512 reduces with increasing air gap above the detector. The strongest effect of the air gap size was observed for small fields of 0.5x 0.5 cm2 and 1x 1 cm2 while the effect was negligible within ± 2% (1 standard deviation) for field sizes larger than 4x 4 cm2. The signal ratio measured with MP512 with air gaps of 0.5 mm and 1.2 mm showed a good agreement with signal ratio measured with the EBT3 film (within ± 2%) and MOSkinTM for 6 MV and 10 MV, respectively. Similar results were observed for the PDD measurement for field size 5x 5 cm2 and 10x 10 cm2. The PDD measured with M512 was in good agreement with Markus Ionization chamber (IC) within ± 1.6% (1 standard deviation) for 6 MV and ± 1.5% (1 standard deviation) for 10 MV. The PDD discrepancy for 2x 2 cm2 was within ± 3% of the EBT3 for both photon energies. The EDW dose profile matched well with the EBT3 for the air gap of 0.5 mm within ± 2% (1 standard deviation) for all wedge angles. The PDD measured by electron beams demonstrated no significant effect of the air gap size above MP512 for all energies. The results showed similar variations (within ± 3%) compared to Markus IC for both 0.5 mm and 2.6 mm gap. Conclusion: The MP512 diode array was demonstrated to be suitable as an in-phantom dosimeter for QA in small radiation treatment fields. The study shows that air gap size has a significant effect on small field photon beam dosimetry due to a loss of electronic equilibrium. The small air gaps of 0.5 mm and 1.2 mm were the best air gaps for 6 MV and 10 MV, respectively. The effect of the air gap in electron beam fields is not significant due to the fact that an electronic equilibrium is fully established.