An electronic device comprising a first main body, a second main body, and a rotating shaft mechanism, wherein the rotating shaft mechanism comprises a rotating shaft base, a first rotating member, a second rotating member, and a linkage assembly, the first rotating member and the second rotating member are each rotatably connected with the rotating shaft base, and the first rotating member is connected with the first main body and the second rotating member is connected with the second main body to drive the first main body and the second main body to unfold or fold relative to each other; and the linkage assembly comprises a first linkage member and a second linkage member, the first linkage member and the second linkage member are each rotatably connected with the rotating shaft base, the first linkage member and the second linkage member are linked with each other, the first linkage member has a first sliding block, the second linkage member has a second sliding block, the first rotating member has a first sliding portion in sliding fit with the first sliding block, the second rotating member has a second sliding portion in sliding fit with the second sliding block, the first rotating member is configured to rotate relative to the rotating shaft base to drive the first sliding block to slide relative to the first rotating member and rotate relative to the rotating shaft base along with the first rotating member, and the second rotating member is configured to rotate relative to the rotating shaft base to drive the second sliding block to slide relative to the second rotating member and rotate relative to the rotating shaft base along with the second rotating member, to make the first rotating member rotate synchronously with the second rotating member through the linkage assembly; the first rotating member further has a first main body portion fixedly connected with the first sliding portion, the first sliding portion is disposed at one side of the first main body portion, a first sliding groove is defined between the first main body portion and the first sliding portion, and the first sliding block is rotatably and slidingly connected with the first sliding groove; and the second rotating member further has a second main body portion fixedly connected with the second sliding portion, the second sliding portion is disposed at one side of the second main body portion, a second sliding groove is defined between the second main body portion and the second sliding portion, and the second sliding block is rotatably and slidingly connected with the second sliding groove. the rotating shaft mechanism comprises a rotating shaft base, a first rotating member, a second rotating member, and a linkage assembly, the first rotating member and the second rotating member are each rotatably connected with the rotating shaft base, and the first rotating member is connected with the first main body and the second rotating member is connected with the second main body to drive the first main body and the second main body to unfold or fold relative to each other; and the linkage assembly comprises a first linkage member and a second linkage member, the first linkage member and the second linkage member are each rotatably connected with the rotating shaft base, the first linkage member and the second linkage member are linked with each other, the first linkage member has a first sliding block, the second linkage member has a second sliding block, the first rotating member has a first sliding portion in sliding fit with the first sliding block, the second rotating member has a second sliding portion in sliding fit with the second sliding block, the first rotating member is configured to rotate relative to the rotating shaft base to drive the first sliding block to slide relative to the first rotating member and rotate relative to the rotating shaft base along with the first rotating member, and the second rotating member is configured to rotate relative to the rotating shaft base to drive the second sliding block to slide relative to the second rotating member and rotate relative to the rotating shaft base along with the second rotating member, to make the first rotating member rotate synchronously with the second rotating member through the linkage assembly; the first rotating member further has a first main body portion fixedly connected with the first sliding portion, the first sliding portion is disposed at one side of the first main body portion, a first sliding groove is defined between the first main body portion and the first sliding portion, and the first sliding block is rotatably and slidingly connected with the first sliding groove; and the second rotating member further has a second main body portion fixedly connected with the second sliding portion, the second sliding portion is disposed at one side of the second main body portion, a second sliding groove is defined between the second main body portion and the second sliding portion, and the second sliding block is rotatably and slidingly connected with the second sliding groove.