When you're moving or adding keys, you can make them snap to time and/or value coordinates on the fcurve graph grid's X/Y axes.
To set up the snapping coordinates
On the Editor page in the Snap Grid controls, set the X (Time) in frame increments and the Y (Value) in value increments for the grid.
If more than one key is selected and translated, only the translation amount is snapped to the grid. The keys that were on the grid remain on the grid and the others remain outside of it. For example, if you have set the X (Time) grid to 5, you would only be able to translate keys horizontally in increments of 5 frames.
Select the Snap option below the X and/or Y options, depending on the coordinates to which you want the keys to snap. For example, if you want keys to snap only to frames, select only the Snap option below X (Time).
Selecting a Snap option is the same as choosing the Edit Snap to Grid command.
Do one of the following to have keys snap to the grid's X (time) and Y (value) coordinates as specified by the Snap Grid coordinates in the Preferences property editor (see above):
Press the Alt key while you drag selected keys.
Middle-click+drag to snap only vertically.
Choose Edit Snap to Grid from the fcurve editor toolbar to activate the "snap" mode, then drag the selected keys.
Choosing this command is the same as selecting a Snap Grid Snap option in the Fcurve Editor Preferences property editor.
To snap keys to the nearest grid point
Select keys or fcurves and choose Keys Move Key to Nearest Grid Point.
The selected keys or the keys on the selected curves are snapped to their nearest relative grid point (time [X] and value [Y] intersection), based on the current grid settings.
If you have selected multiple keys and they would be snapped to the same grid time, no snapping occurs for the time, but it will occur for values.
From the fcurve editor toolbar, choose Edit Snap to Frame.
When you move keys, they snap only to whole frames (such as 1, 2, 3, etc.), not between frames (such as 1.45, 2.38, etc.).
If you want your keys to automatically snap to frames while you are working, choose Edit Auto Snap to Frames (Discrete Time). This merges all the keys within the same frame boundary.