I found tutorials on how to find the sha256 hash of files, but cannot seem to find one on simple text (not a text file). Does anyone know how to do that?

1 Answer 1


You can echo the text and pipe it to shasum. You'll want to use the -a 256 option to calculate sha256:

Thanks to JMY1000 in the comments: Since echo adds a newline by default, -n should probably be added in order to get the proper shasum of the text without this newline.

echo -n "simple text" | shasum -a 256

If you want to get the hash value for a text which is already open in an editor, copy it to the clipboard and run

pbpaste | shasum -a 256

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .