According to one embodiment, an image encoding method includes selecting a motion reference block from an already-encoded pixel block. The method includes selecting an available block including different motion information from the motion reference block, and selecting a selection block from the available block. The method includes generating a predicted image of the encoding target block using motion information of the selection block. The method includes encoding a prediction error between the predicted image and an original image. The method includes encoding selection information identifying the selection block by referring to a code table decided according to a number of the available block.