We report the discovery of a simple environmental sensing mechanism for biofilm formation in the bacterium Bacillus subtilis that operates without the involvement of a dedicated RNA or protein. Certain serine codons, the four TCN codons, in the gene for the biofilm repressor SinR caused a lowering of SinR levels under biofilm-inducing conditions. Synonymous substitutions of these TCN codons with AGC or AGT impaired biofilm formation and gene expression. Conversely, switching AGC or AGT to TCN codons upregulated biofilm formation. Genome-wide ribosome profiling showed that ribosome density was higher at UCN codons than at AGC or AGU during biofilm formation. Serine starvation recapitulated the effect of biofilm-inducing conditions on ribosome occupancy and SinR production. As serine is one of the first amino acids to be exhausted at the end of exponential phase growth, reduced translation speed at serine codons may be exploited by other microbes in adapting to stationary phase.