The payload is cut into segments. Digits use numeric mode, upper-case letters and the symbol set use alphanumeric mode, and everything else is encoded as UTF-8 bytes with an ECI header so Korean, Japanese and Chinese text survives the trip to the scanner.
The segments become a bit stream with a mode indicator, a character count and a terminator, padded to whole codewords. The smallest version from 1 to 40 that fits at the chosen error-correction level is used, so a short link does not become a 177-module wall.
Codewords are split into blocks, each block gets Reed-Solomon error-correction codewords over GF(256), and the blocks are interleaved so a scratch damages a little of every block instead of all of one. L recovers about 7% of the code, M 15%, Q 25% and H 30%.
The matrix gets its finder patterns, timing lines, alignment patterns, format information and, from version 7, version information. All eight data masks are tried and the one with the lowest standard penalty score is kept, which is what keeps large codes readable.