The segmentation of brain tumor plays an important role in diagnosis, treatment planning, and surgical simulation. The precise segmentation of brain tumor can help clinicians obtain its location, size, and shape information. We propose a fully automatic brain tumor segmentation method based on kernel sparse coding. It is validated with 3D multiple-modality magnetic resonance imaging(MRI). In this method, MRI images are pre-processed first to reduce the noise, and then kernel dictionary learning is used to extract the nonlinear features to construct five adaptive dictionaries for healthy tissues, necrosis, edema, non-enhancing tumor, and enhancing tumor tissues. Sparse coding is performed on the feature vectors extracted from the original MRI images, which are a patch of m×m×m around the voxel. A kernel-clustering algorithm based on dictionary learning is developed to code the voxels. In the end, morphological filtering is used to fill in the area among multiple connected components to improve the segmentation quality. To assess the segmentation performance, the segmentation results are uploaded to the online evaluation system where the evaluation metrics dice score, positive predictive value(PPV), sensitivity, and kappa are used. The results demonstrate that the proposed method has good performance on the complete tumor region(dice: 0.83; PPV: 0.84; sensitivity: 0.82), while slightly worse performance on the tumor core(dice: 0.69; PPV: 0.76; sensitivity: 0.80) and enhancing tumor(dice: 0.58; PPV: 0.60; sensitivity: 0.65). It is competitive to the other groups in the brain tumor segmentation challenge. Therefore, it is a potential method in differentiation of healthy and pathological tissues.