According to one embodiment, an image encoding method includes a first step of selecting a motion reference block from an already-encoded pixel block to which an inter prediction is applied, the motion reference block including a first motion reference block that is spatially adjacent to an encoding target block in an upward direction and a second motion reference block that is spatially adjacent to the encoding target block in a left direction. The method includes a second step of selecting one or more available blocks from the motion reference block, the available blocks each including a candidate of motion information applied to the encoding target block and different motion information. The method includes a third step of selecting a selection block from the available blocks. The method includes a fourth step of generating a predicted image of the encoding target block using motion information of the selection block. The method includes a fifth step of encoding a prediction error between the predicted image and an original image. The method includes a sixth step of encoding selection information specifying the selection block by referring to a code table decided according to a number of the available blocks.