WCAG calculates the ratio from the relative luminance of the lighter and darker color: (lighter + 0.05) ÷ (darker + 0.05). Black on white is 21:1; the same color on itself is 1:1.
For level AA, normal text needs at least 4.5:1 and large text (24 px, or about 18.7 px bold) needs 3:1. Level AAA raises those to 7:1 and 4.5:1. Icons, input borders and other interface parts need 3:1 against their surroundings.
Example
Gray #767676 on white is about 4.54:1, just enough for AA; #777777 is about 4.48:1 and fails.