You used to be able to use synergy, but that has become non-free.
Now you have the following two free alternatives:
Input Director enables the control of multiple Windows systems using the keyboard/mouse attached to one computer
Switch control between systems either by hotkey or by moving the cursor off the screen edge on one computer for it to appear on the next one
Input Director supports a shared clipboard – copy on one computer, switch control, and paste
Input Director is compatible with Windows 10, Windows 8/8.1, Windows 7, Windows 2008, Windows Vista, Windows 2003 and Windows XP(SP2). The systems must be networked.
it allows you to reach across your PC’s as if they were part of one single desktop… I can move files between the 2 computers simply by dragging them from one desktop to another. In fact you can control up to four computers from a single mouse and keyboard with no extra hardware needed