An electronic device swappable to be embedded into a system cabinet includes a casing and a locking element. The casing includes a first sidewall and a second sidewall, which have a first opening and a second opening, respectively. The locking element includes a first end part, a protrusion part, a bent part and a second end part. The first end part is fixed on an inner surface of the second sidewall of the casing. The protrusion part is partially exposed from the second opening to be engaged with a receiving structure of the system cabinet. The bent part is arranged between the first end part and the protrusion part. The second end part is exposed from the first opening so as to be protruded from the first sidewall of the casing.