The invention relates to a lock, in particular to a three-dimensional code nut lock. In order to overcome the defects that an existing mechanical lock is low in key scale, and the material of a lock cylinder is low in strength, a traditional axis type lock cylinder is abandoned, lock codes and key codes are fully laid out in three spatial dimensions, a key code needle bar is directly used for pushing a lock code needle bar, and a large key scale of trillions and a high-strength lock cylinder are achieved. According to the lock cylinder technology adopted in the invention, a lock code sieve anda bolt honeycomb are tightly attached, the lock code sieve is provided with a plurality of holes in a two-dimensional arrangement mode, the holes contain lock codes in multiple code numbers, three-dimensional layout of the lock codes is formed, the bolt honeycomb is provided with a plurality of concaves according to a two-dimensional arrangement mode, the concaves contain bolts and springs, a screw hole is formed in the center of the bolt honeycomb, an axial hole is formed in the center of the lock code sieve, one end of a lock beam is provided with an axial portion, the other end of the lockbeam is provided with a screw end, the axial hole is matched with the axial portion, and the screw hole is engaged with the screw end.