An electronic device is provided. The electronic device includes a first body, a second body, a speaker cabinet and a link mechanism. The second body rotates relative to the first body by a hinge. The speaker cabinet, disposed in the first body, is selectively lengthened or shortened. The link mechanism connects the hinge with the speaker cabinet. When the second body is closed relative to the first body, the speaker cabinet is concealed in the first body, and when the second body is opened relative to the first body, the hinge drives the link mechanism to press the speaker cabinet, enabling the speaker to be lengthened or to be shortened.