The invention relates to an encoding device, a decoding device, an encoding method, a decoding method, and a storage medium. This encoding device is provided with: a circuit that, during operation, generates CTU size information indicating a luminance CTB (Coding Tree Block) size of a CTU (
Coding Tree Unit), generates a flag indicating whether or not sub-picture information relating to a sub-picture, which is a rectangular region in a picture, is included, and stores the generated flag; in a case where the flag indicates that the sub-picture information is included, sub-picture position information is generated that indicates a horizontal position and a vertical position of a left upper CTU of the sub-picture, respectively, using the luminance CTB size. Generating a bit
stream in which the CTU size information and the sub-picture position information are stored in a sequence parameter set, the CTU size information being stored in the sequence parameter set before the flag and the sub-picture position information are stored, in a case where the picture includes two or more sub-pictures, and the sub-picture position information being stored in the sequence parameter set before the flag and the sub-picture position information are stored in the sequence parameter set. The sequence parameter set comprises the sub-picture information.