How QR codes store data
A QR (Quick Response) code is a 2D barcode: a grid of black and white squares called modules that encode data both horizontally and vertically. The three large squares in the corners are finder patterns that let a camera locate and orient the code. The rest of the grid holds your encoded text plus built-in error-correction data.
The encoder converts your text to bytes, adds Reed–Solomon error-correction codewords, and lays everything out on the smallest grid (version) that fits. More data means a denser grid.
Worked example
Encoding the URL https://calcool.us/:
Error correction levels
QR codes can still be read even when partly damaged or obscured, thanks to four error-correction levels: L (~7%), M (~15%), Q (~25%) and H (~30%). Higher levels recover from more damage but make the code denser. Level M is a good default; choose H if the code will be printed small, placed on a curved surface, or might get scuffed. Keep a quiet (white) margin around the code so scanners can find it.