Low-cost, high-throughput gene synthesis and precise control of protein expression are of critical importance to synthetic biology and biotechnology. Here we describe the development of an on-chip gene synthesis technology, which integrates on a single microchip the synthesis of DNA oligonucleotides using inkjet printing, isothermal oligonucleotide amplification and parallel gene assembly. Use of a mismatch-specific endonuclease for error correction results in an error rate of ~0.19 errors per kb. We applied this approach to synthesize pools of thousands of codon-usage variants of lacZα and 74 challenging Drosophila protein antigens, which were then screened for expression in Escherichia coli. In one round of synthesis and screening, we obtained DNA sequences that were expressed at a wide range of levels, from zero to almost 60% of the total cell protein mass. This technology may facilitate systematic investigation of the molecular mechanisms of protein translation and the design, construction and evolution of macromolecular machines, metabolic networks and synthetic cells.