MSFvenom is a combination of Msfpayload and Msfencode, used to generate and output all of the various types of shell code that are available in Metasploit.
Obfuscation involves obscuring information by making it difficult to understand and detect. Weaker than encryption, these methods can usually be reverse engineered and are intended as a more temporary method of disguising payloads or network communications.
Encode and Decode string
echo -n "ping /n 1 198.51.100.2" | base64
> cGluZyAvbiAxIDE5Mi4wLjIuMg==
echo -n "cGluZyAvbiAxIDE5Mi4wLjIuMg==" | base64 -d
> ping /n 1 198.51.100.2
Execute encoded Powershell command
echo -n "ping /n 1 198.51.100.2" | base64
> cGluZyAvbiAxIDE5Mi4wLjIuMg==
PS C:\> powershell.exe -ec cGluZyAvbiAxIDE5Mi4wLjIuMg==