We show how the binary encoding and decoding of typed data and typed programs can be understood, programmed, and verified with the help of question-answer games. The encoding of a value is determined by the yes/no answers to a sequence of questions about that value; conversely, decoding is the interpretation of binary data as answers to the same question scheme. We introduce a general framework for writing and verifying game-based codecs. We present games in Haskell for structured, recursive, polymorphic, and indexed types, build-ing up to a representation of well-typed terms in the simply-typed λ-calculus with poly-morphic constants. The framework makes novel use of isomorphisms between types in the definition of games. The definition of i...