A method is disclosed for processing binary data prior to magnetic recording. The binary data is divided into 4-bit data segments which are converted to 8-bit codes according to a predetermined encoding transfer function describing the relationships between the 4-bit data segments and corresponding 8-bit codes, wherein the bit pattern of each 8-bit code has an intra-code run-length of at least two "0" bits and forms an inter-code run-length of from at least two "0" bits to at most nine "0"bits with an adjacent 8-bit code. The method further includes the step of generating a frame synchronization code and interleaving it with 8-bit codes to form a frame of binary digits. The frame sync code has a bit pattern which is unduplicatable by any combination of 8-bit codes that follow.