A communication method, comprising: encoding (S201, S801) a to-be-transmitted first bit sequence to obtain a first matrix, wherein the first matrix comprises a plurality of bit square matrices of a same size, and each bit square matrix comprises a plurality of pieces of bit data; performing (S202, S802), based on a first mapping relationship, position transformation in a range of each bit square matrix on the bit data of each bit square matrix in the first matrix, to obtain a second matrix, wherein the first mapping relationship indicates a position mapping relationship before and after position transformation of each piece of bit data in the bit square matrix range, the first mapping relationship comprises a row transformation mapping relationship, the row transformation mapping relationship is constrained by using a global offset constraint factor and at least two local offset constraint factors, the global offset constraint factor is used to constrain a position offset of row transformation of each piece of bit data in the bit square matrix, and the local offset constraint factor is used to constrain position offsets of row transformation of bit data located in some bit rows in the bit square matrix; performing (S203, S803) bit data position transformation among bit square matrices on the second matrix to obtain a third matrix; and modulating (S204, S804) a to-be-sent first symbol sequence based on the third matrix; wherein when a quantity of rows and a quantity of columns of bit square matrices comprised in the first matrix are both 2^m, there are m-1 local offset constraint factors, wherein m is an integer greater than 3. encoding (S201, S801) a to-be-transmitted first bit sequence to obtain a first matrix, wherein the first matrix comprises a plurality of bit square matrices of a same size, and each bit square matrix comprises a plurality of pieces of bit data; performing (S202, S802), based on a first mapping relationship, position transformation in a range of each bit square matrix on the bit data of each bit square matrix in the first matrix, to obtain a second matrix, wherein the first mapping relationship indicates a position mapping relationship before and after position transformation of each piece of bit data in the bit square matrix range, the first mapping relationship comprises a row transformation mapping relationship, the row transformation mapping relationship is constrained by using a global offset constraint factor and at least two local offset constraint factors, the global offset constraint factor is used to constrain a position offset of row transformation of each piece of bit data in the bit square matrix, and the local offset constraint factor is used to constrain position offsets of row transformation of bit data located in some bit rows in the bit square matrix; performing (S203, S803) bit data position transformation among bit square matrices on the second matrix to obtain a third matrix; and modulating (S204, S804) a to-be-sent first symbol sequence based on the third matrix; wherein when a quantity of rows and a quantity of columns of bit square matrices comprised in the first matrix are both 2^m, there are m-1 local offset constraint factors, wherein m is an integer greater than 3.