How to get screenshot to clipboard? [duplicate]

It's already there…

System Prefs > Keyboard > Shortcuts > Screenshots

By default
Cmd ⌘ Shift ⇧ 4 will save as a file
Cmd ⌘ Opt ⌥ Shift ⇧ 4 will save to clipboard.

enter image description here