An image encoding method for generating a bitstream by encoding a picture, the image encoding method comprising: sequentially encoding blocks included in the picture; deriving an encoding amount of a slice segment each time one of the blocks is encoded as a current block, the slice segment including the current block; determining whether the encoding amount derived is at least a threshold; and setting end information indicating an end of the slice segment in a position in the bitstream when the encoding amount is determined to be at least the threshold, the position corresponding to the current block encoded, determining whether the number of encoded blocks included in the slice segment the encoding amount of which has been derived among the blocks is at least an upper limit block count, when the encoding amount derived is determined to be lower than the threshold; setting the end information indicating the end of the slice segment in the position in the bitstream when the number of the encoded blocks is determined to be at least the upper limit block count, the position corresponding to the current block encoded; characterized by setting a default block count which is a predetermined number, as an initial value of the upper limit block count, and updating the upper limit block count according to a slice segment block count which is the number of the encoded blocks included in the slice segment the end of which is indicated by the end information; wherein in updating the upper limit block count, the upper limit block count is updated by adding the default block count to a value obtained by subtracting the slice segment block count from the upper limit block count before being updated. sequentially encoding blocks included in the picture; deriving an encoding amount of a slice segment each time one of the blocks is encoded as a current block, the slice segment including the current block; determining whether the encoding amount derived is at least a threshold; and setting end information indicating an end of the slice segment in a position in the bitstream when the encoding amount is determined to be at least the threshold, the position corresponding to the current block encoded, determining whether the number of encoded blocks included in the slice segment the encoding amount of which has been derived among the blocks is at least an upper limit block count, when the encoding amount derived is determined to be lower than the threshold; setting the end information indicating the end of the slice segment in the position in the bitstream when the number of the encoded blocks is determined to be at least the upper limit block count, the position corresponding to the current block encoded; characterized by setting a default block count which is a predetermined number, as an initial value of the upper limit block count, and updating the upper limit block count according to a slice segment block count which is the number of the encoded blocks included in the slice segment the end of which is indicated by the end information; wherein in updating the upper limit block count, the upper limit block count is updated by adding the default block count to a value obtained by subtracting the slice segment block count from the upper limit block count before being updated.