Abstract A new two dimensional Diagonal Eigenvalue Unity (2D-DEU) code is developed for the spectral⧹spatial optical code division multiple access (OCDMA) system. It has a lower cross correlation value compared to two dimensional diluted perfect difference (2D-DPD), two dimensional Extended Enhanced Double Weight (2D-Extended-EDW) codes. Also, for the same code length, the number of users can be generated by the 2D-DEU code is higher than that provided by the others codes. The Bit Error Rate ( BER ) numerical analysis is developed by considering the effects of shot noise, phase induced intensity noise (PIIN), and thermal noise. The main result shows that BER is strongly affected by PIIN for the higher source power. The 2D-DEU code performance is compared with 2D-DPD, 2D-Extended-EDW and two dimensional multi-diagonals (2D-MD) codes. This comparison proves that the proposed 2D-DEU system outperforms the related codes.