Perception is a subjective experience that depends on the expectations and beliefs of an observer. Psychophysical measures provide an objective yet indirect characterization of this experience by describing the dependency between the physical properties of a stimulus and the corresponding perceptually guided behavior. Two fundamental psychophysical measures characterize an observer's perception of a stimulus: how well the observer can discriminate the stimulus from similar ones (discrimination threshold) and how strongly the observer's perceived stimulus value deviates from the true stimulus value (perceptual bias). It has long been thought that these two perceptual characteristics are independent. Here we demonstrate that discrimination threshold and perceptual bias show a surprisingly simple mathematical relation. The relation, which we derived from assumptions of optimal sensory encoding and decoding, is well supported by a wide range of reported psychophysical data including perceptual changes induced by spatial and temporal context, and attention. The large empirical support suggests that the proposed relation represents a new law of human perception. Our results imply that universal rules govern the computational processes underlying human perception.