The Internet of things (IoT), which has been widespread and large-scale applied, arises more and more security and privacy issues. Lightweight encryption is an important measurement for ensuring confidentiality for devices of IoT, in where the computing, storage and energy resources are always limited. However, the shallow application of lightweight block cipher will change the format of ciphertext tremendously due to confusion and diffusion operations. These changes make the ciphertext inconsistent with plaintext in expressive form and format, and lead to require extra storage, computation and redisplay resources. Lightweight format-preserving encryption algorithm can ensure data confidentiality while maintaining the format consistency between ciphertext and plaintext, and these features benefit to IoT greatly. Aiming at the problems that the traditional format-preserving encryption algorithm performs inefficiently, consumes many resources, and cannot encrypt length numeric data, a lightweight format-preserving encryption algorithm oriented to number is proposed in this work. Firstly, a numeric typed permutation table is constructed by using lightweight block cipher algorithm; then the numerical plaintext is added to the key of lightweight block cipher in one-to-one correspondence, and the modulo 10 operation is performed; at last, replacement cryptographic operation is performed to obtain the numerical ciphertext by using the proposed the numeric typed replacement table. The proposed algorithm preserves the format for any numerical data with arbitrary length, and it’s also consistent with the original lightweight block cipher in terms of efficiency and security. By comparing with traditional format-preserving encryption, the experimental result shows that the proposed algorithm is more security, more efficient and more lowly lower resource-consuming. It is suitable for secure storage and data marking of numerical data in resource-constrained environment devices of IoT.