Precise control of protein synthesis by engineering sequence elements in 5' untranslated regions (5' UTRs) remains a fundamental challenge. To accelerate our understanding of the cis-regulatory code embedded in 5' UTRs, we devised massively parallel reporter assays from a synthetic messenger RNA library composed of over one million 5' UTR variants. A completely randomized 10-nucleotide sequence preceding an upstream open reading frame (uORF) and downstream GFP drives a broad range of translational outputs and mRNA stability in mammalian cells. While efficient translation protects mRNA from degradation, uORF translation triggers mRNA decay in a UPF1-dependent manner. We also identified translational inhibitory elements with G-quadruplexes as marks for mRNA decay in P-bodies. Unexpectedly, an unstructured A-rich element in 5' UTRs destabilizes mRNAs in the absence of translation, although it enables cap-independent translation. Our results not only identify diverse sequence features of 5' UTRs that control mRNA translatability, but they also reveal ribosome-dependent and ribosome-independent mRNA-surveillance pathways.