In computer science, group coded recording or group code recording (GCR) refers to several distinct but related encoding methods for representing data on magnetic media. The first, used in magnetic tape since 1973, is an error-correcting code combined with a run-length limited (RLL) encoding scheme, belonging into the group of modulation codes. The others are similar encoding methods used in mainframe hard disks or microcomputer floppy disks until the late 1980s. GCR is a modified form of a NRZI code, but necessarily with a higher transition density.

Magnetic tape Group coded recording was first used for magnetic-tape data storage on 9-track reel-to-reel tape. The term was coined during the development of the IBM 3420 Model 4/6/8 Magnetic Tape Unit and the corresponding 3803 Model 2 Tape Control Unit, both introduced in 1973. IBM referred to the error correcting code itself as "group coded recording". However, GCR has come to refer to the recording format of (250 bits/mm) tape as a whole, and later to formats which use similar RLL codes without the error correction code.

In order to reliably read and write to magnetic tape, several constraints on the signal to be written must be followed. The first is that two adjacent flux reversals must be separated by a certain distance on the media, defined by the magnetic properties of the media itself. The second is that there must be a reversal often enough to keep the reader's clock in phase with the written signal; that is, the signal must be self-clocking and most importantly to keep the playback output high enough as this is proportional to the density of flux transitions. Prior to tapes, tapes satisfied these constraints using a technique called phase encoding (PE), which was only 50% efficient. For GCR tapes, a (0, 2) RLL code is used, or more specifically a  (0, 2) block code sometimes also referred to as GCR (4B-5B) encoding. This code requires five bits to be written for every four bits of data. The code is structured so that no more than two zero bits (which are represented by lack of a flux reversal) can occur in a row, either within a code or between codes, no matter what the data was. This RLL code is applied independently to the data going to each of the nine tracks.

Of the 32 five-bit patterns, eight begin with two consecutive zero bits, six others end with two consecutive zero bits, and one more (10001) contains three consecutive zero bits. Removing the all-ones pattern (11111) from the remainder leaves 16 suitable code words.

The GCR RLL code: 4-bit value GCR code hex bin bin hex 0x0 0000 1.1001 0x19 0x1 0001 1.1011 0x1B 0x2 0010 1.0010 0x12 0x3 0011 1.0011 0x13 0x4 0100 1.1101 0x1D 0x5 0101 1.0101 0x15 0x6 0110 1.0110 0x16 0x7 0111 1.0111 0x174-bit value GCR code hex bin bin hex 0x8 1000 1.1010 0x1A 0x9 1001 0.1001 0x09 0xA 1010 0.1010 0x0A 0xB 1011 0.1011 0x0B 0xC 1100 1.1110 0x1E 0xD 1101 0.1101 0x0D 0xE 1110 0.1110 0x0E 0xF 1111 0.1111 0x0F 11 of the nibbles (other than xx00 and 0001) have their code formed by prepending the complement of the most significant bit; i.e. abcd is encoded as abcd. The other five values are assigned codes beginning with 11. Nibbles of the form ab00 have codes 11ba, i.e. the bit reverse of the code for ab11. The code 0001 is assigned the remaining value 11011.

Because the all-ones code is not used in normal data, at most 8 one-bits can appear in a row. Sequences of 9 or more one-bits (in practice 14 all-ones codes, or 70 one-bits, were used) are used as a synchronization pattern.

Because of the extremely high density (for the time) of tape, the RLL code is not sufficient to ensure reliable data storage. On top of the RLL code, an error-correcting code called the Optimal Rectangular Code (ORC) is applied. This code is a combination of a parity track and polynomial code similar to a CRC, but structured for error correction rather than error detection. For every seven bytes written to the tape (before RLL encoding), an eighth check byte is calculated and written to the tape. When reading, the parity is calculated on each byte and exclusive-ORed with the contents of the parity track, and the polynomial check code calculated and exclusive-ORed with the received check code, resulting in two 8-bit syndrome words. If these are both zero, the data is error free. Otherwise, error-correction logic in the tape controller corrects the data before it is forwarded to the host. The error correcting code is able to correct any number of errors in any single track, or in any two tracks if the erroneous tracks can be identified by other means.

In newer IBM half-inch 18-track tape drives recording at ,  (0, 2) GCR was replaced by a more efficient  (0, 3) modulation code, mapping eight bits to nine bits.

Hard disks In the mid-1970s, Sperry Univac, ISS Division was working on large hard drives for the mainframe business using group coding.

Floppy disks Like magnetic tape drives, floppy disk drives have physical limits on the spacing of flux reversals (also called transitions, represented by one-bits).

Micropolis Offering GCR-compatible diskette drives and floppy disk controllers (like the 100163-51-8 and 100163-52-6)), Micropolis endorsed data encoding with group coded recording on 5¼-inch 100 tpi 77-track diskette drives to store twelve 512-byte sectors per track since 1977 or 1978.

Micro Peripherals Micro Peripherals, Inc. (MPI) marketed double-density 5¼-inch disk drives (like the single-sided B51 and double-sided B52 drives) and a controller solution implementing GCR since early 1978.

Durango The Durango Systems F-85 (introduced in September 1978) used single-sided 5¼-inch 100 tpi diskette drives providing 480 KB utilizing a proprietary high-density 4/5 group coded encoding. The machine was using a Western Digital FD1781 floppy disk controller, designed by a former Sperry ISS engineer, with 77-track Micropolis drives. In later models such as the Durango 800 series this was expanded to a double-sided option for 960 KB (946 KB formatted) per diskette.

Apple For the Apple II floppy drive, Steve Wozniak invented a floppy controller which (along with the Disk II drive itself) imposed two constraints: Between any two one bits, there may be a maximum of one zero bit. Each 8-bit byte must start with a one bit.

The simplest scheme to ensure compliance with these limits is to record an extra "clock" transition before each data bit according to differential Manchester encoding or (digital) FM (frequency modulation). Known as 4-and-4 encoding, the resulting Apple implementation allowed only ten 256-byte sectors per track to be recorded on a single-density 5¼-inch floppy. It uses two bytes for each byte.

|+4-and-4 encoding table

Value Code hex bin bin hex 0x00 0000.0000 1010.1010 1010.1010 0xAA 0xAA 0x01 0000.0001 1010.1010 1010.1011 0xAA 0xAB 0x02 0000.0010 1010.1011 1010.1010 0xAB 0xAA 0x03 0000.0011 1010.1011 1010.1011 0xAB 0xAB 0x04 0000.0100 1010.1010 1010.1110 0xAA 0xAE 0x05 0000.0101 1010.1010 1010.1111 0xAA 0xAF 0x06 0000.0110 1010.1011 1010.1110 0xAB 0xAE 0x07 0000.0111 1010.1011 1010.1111 0xAB 0xAF 0x08 0000.1000 1010.1110 1010.1010 0xAE 0xAA 0x09 0000.1001 1010.1110 1010.1011 0xAE 0xAB 0x0A 0000.1010 1010.1111 1010.1010 0xAF 0xAA 0x0B 0000.1011 1010.1111 1010.1011 0xAF 0xAB 0x0C 0000.1100 1010.1110 1010.1110 0xAE 0xAE 0x0D 0000.1101 1010.1110 1010.1111 0xAE 0xAF 0x0E 0000.1110 1010.1111 1010.1110 0xAF 0xAE 0x0F 0000.1111 1010.1111 1010.1111 0xAF 0xAF 0x10 0001.0000 1010.1010 1011.1010 0xAA 0xBA 0x11 0001.0001 1010.1010 1011.1011 0xAA 0xBB 0x12 0001.0010 1010.1011 1011.1010 0xAB 0xBA 0x13 0001.0011 1010.1011 1011.1011 0xAB 0xBB 0x14 0001.0100 1010.1010 1011.1110 0xAA 0xBE 0x15 0001.0101 1010.1010 1011.1111 0xAA 0xBF 0x16 0001.0110 1010.1011 1011.1110 0xAB 0xBE 0x17 0001.0111 1010.1011 1011.1111 0xAB 0xBF 0x18 0001.1000 1010.1110 1011.1010 0xAE 0xBA 0x19 0001.1001 1010.1110 1011.1011 0xAE 0xBB 0x1A 0001.1010 1010.1111 1011.1010 0xAF 0xBA 0x1B 0001.1011 1010.1111 1011.1011 0xAF 0xBB 0x1C 0001.1100 1010.1110 1011.1110 0xAE 0xBE 0x1D 0001.1101 1010.1110 1011.1111 0xAE 0xBF 0x1E 0001.1110 1010.1111 1011.1110 0xAF 0xBE 0x1F 0001.1111 1010.1111 1011.1111 0xAF 0xBF 0x20 0010.0000 1011.1010 1010.1010 0xBA 0xAA 0x21 0010.0001 1011.1010 1010.1011 0xBA 0xAB 0x22 0010.0010 1011.1011 1010.1010 0xBB 0xAA 0x23 0010.0011 1011.1011 1010.1011 0xBB 0xAB 0x24 0010.0100 1011.1010 1010.1110 0xBA 0xAE 0x25 0010.0101 1011.1010 1010.1111 0xBA 0xAF 0x26 0010.0110 1011.1011 1010.1110 0xBB 0xAE 0x27 0010.0111 1011.1011 1010.1111 0xBB 0xAF 0x28 0010.1000 1011.1110 1010.1010 0xBE 0xAA 0x29 0010.1001 1011.1110 1010.1011 0xBE 0xAB 0x2A 0010.1010 1011.1111 1010.1010 0xBF 0xAA 0x2B 0010.1011 1011.1111 1010.1011 0xBF 0xAB 0x2C 0010.1100 1011.1110 1010.1110 0xBE 0xAE 0x2D 0010.1101 1011.1110 1010.1111 0xBE 0xAF 0x2E 0010.1110 1011.1111 1010.1110 0xBF 0xAE 0x2F 0010.1111 1011.1111 1010.1111 0xBF 0xAF 0x30 0011.0000 1011.1010 1011.1010 0xBA 0xBA 0x31 0011.0001 1011.1010 1011.1011 0xBA 0xBB 0x32 0011.0010 1011.1011 1011.1010 0xBB 0xBA 0x33 0011.0011 1011.1011 1011.1011 0xBB 0xBB 0x34 0011.0100 1011.1010 1011.1110 0xBA 0xBE 0x35 0011.0101 1011.1010 1011.1111 0xBA 0xBF 0x36 0011.0110 1011.1011 1011.1110 0xBB 0xBE 0x37 0011.0111 1011.1011 1011.1111 0xBB 0xBF 0x38 0011.1000 1011.1110 1011.1010 0xBE 0xBA 0x39 0011.1001 1011.1110 1011.1011 0xBE 0xBB 0x3A 0011.1010 1011.1111 1011.1010 0xBF 0xBA 0x3B 0011.1011 1011.1111 1011.1011 0xBF 0xBB 0x3C 0011.1100 1011.1110 1011.1110 0xBE 0xBE 0x3D 0011.1101 1011.1110 1011.1111 0xBE 0xBF 0x3E 0011.1110 1011.1111 1011.1110 0xBF 0xBE 0x3F 0011.1111 1011.1111 1011.1111 0xBF 0xBF