A new method for realizing spectral phase optical code-division multiple-access (OCDMA) coding based on step chirped fiber Bragg gratings (SCFBGs) is proposed and the corresponding encoder/decoder is presented. With this method, a mapping code is introduced for the m-sequence address code and the phase shift can be inserted into the subgratings of the SCFBG according to the mapping code. The transfer matrix method together with Fourier transform is used to investigate the characteristics of the encoder/decoder. The factors that influence the correlation property of the encoder/decoder, including index modulation and bandwidth of the subgrating, are identified. The system structure is simple and good correlation output can be obtained. The performance of the OCDMA system based on SCFBGs has been analyzed.