A semiconductor device comprising: a conductive substrate; a semiconductor structure disposed on the conductive substrate and including a first conductive semiconductor layer, a second conductive semiconductor layer, and an active layer disposed between the first conductive semiconductor layer and the second conductive semiconductor layer; and a first electrode disposed on the semiconductor structure and electrically connected to the first conductive semiconductor layer, wherein the semiconductor structure further includes a 1-1 conductive semiconductor layer between the first conductive semiconductor layer and the first electrode, and a top surface of the semiconductor structure includes a flat part, on which the first electrode is disposed, and a concave-convex part surrounding the flat part, characterised in that a second distance from a bottom surface of the semiconductor structure to a bottom surface of the concave-convex part contacting with a side surface of the flat part is 70 to 95% of a first distance from the bottom surface of the semiconductor structure to a top surface of the 1-1 conductive semiconductor layer, and in that the second conductive semiconductor layer further includes a 2-1 conductive semiconductor layer, a 2-2 conductive semiconductor layer including a first dopant and a second dopant and disposed on a bottom of the 2-1 conductive semiconductor layer, and a 2-3 conductive semiconductor layer disposed on a bottom of the 2-2 conductive semiconductor layer and including the first dopant and the second dopant, wherein the concentration of the first dopant included in the 2-2 conductive semiconductor layer and the concentration of the first dopant included in the 2-3 conductive semiconductor layer are different from each other, and the concentration of the second dopant included in the 2-2 conductive semiconductor layer and the concentration of the second dopant included in the 2-3 conductive semiconductor layer are different from each other, wherein the first dopant is Mg and the second dopant is C, and the concentration of Mg included in the 2-2 conductive semiconductor layer is higher than the concentration of Mg included in the 2-3 conductive semiconductor layer, and the concentration of C included in the 2-2 conductive semiconductor layer is lower than the concentration of C included in the 2-3 conductive semiconductor layer. a conductive substrate; a semiconductor structure disposed on the conductive substrate and including a first conductive semiconductor layer, a second conductive semiconductor layer, and an active layer disposed between the first conductive semiconductor layer and the second conductive semiconductor layer; and a first electrode disposed on the semiconductor structure and electrically connected to the first conductive semiconductor layer, wherein the semiconductor structure further includes a 1-1 conductive semiconductor layer between the first conductive semiconductor layer and the first electrode, and a top surface of the semiconductor structure includes a flat part, on which the first electrode is disposed, and a concave-convex part surrounding the flat part, characterised in that a second distance from a bottom surface of the semiconductor structure to a bottom surface of the concave-convex part contacting with a side surface of the flat part is 70 to 95% of a first distance from the bottom surface of the semiconductor structure to a top surface of the 1-1 conductive semiconductor layer, and in that the second conductive semiconductor layer further includes a 2-1 conductive semiconductor layer, a 2-2 conductive semiconductor layer including a first dopant and a second dopant and disposed on a bottom of the 2-1 conductive semiconductor layer, and a 2-3 conductive semiconductor layer disposed on a bottom of the 2-2 conductive semiconductor layer and including the first dopant and the second dopant, wherein the concentration of the first dopant included in the 2-2 conductive semiconductor layer and the concentration of the first dopant included in the 2-3 conductive semiconductor layer are different from each other, and the concentration of the second dopant included in the 2-2 conductive semiconductor layer and the concentration of the second dopant included in the 2-3 conductive semiconductor layer are different from each other, wherein the first dopant is Mg and the second dopant is C, and the concentration of Mg included in the 2-2 conductive semiconductor layer is higher than the concentration of Mg included in the 2-3 conductive semiconductor layer, and the concentration of C included in the 2-2 conductive semiconductor layer is lower than the concentration of C included in the 2-3 conductive semiconductor layer.