To generate a 32-byte (256 bits) random key in base64 format, use the command below. This is usually used for secrets and tokens. It’s generally preferred over hex since the former has lower overhead.
openssl rand -base64 32
YR/lpfHethLBx7NHU8qOHexJNyFVsJdr9Try18zqSrU=