The use of 12-bit levels of grayscale in medical image representation allows for more precise image analysis and diagnosis, and encrypting such images is essential for protecting patient privacy and security. Existing 8-bit image encryption schemes become inefficient when applied to 12-bit images. In this paper, we design a cryptographically strong encryption scheme to improve the efficiency of encrypting 12bit medical images. The core of the proposed scheme is a key-dependent 12×12 S-box, which plays a crucial role in enhancing the security and efficiency of the encryption scheme. Most notably, test results show that 12×12 S-boxes offer significantly stronger confusion and key-sensitivity than their 8×8 counterparts. This finding enables the proposed 12×12 S-box-based scheme to process 12-bit images 3.3 times faster than an 8×8 S-box while passing all security tests. Experimental results show that the proposed scheme can encrypt 12-bit images at speeds up to 300MB/s. Moreover, the proposed scheme has also been shown to efficiently handle 8-bit images. Comparative results highlight the security and efficiency advantages of the proposed scheme over existing medical image encryption schemes.INDEX TERMS Image encryption. key-dependent S-box. key-sensitivity. medical images. secure healthcare. 12-bit image encryption.