Developer & Web
Base64 to SHA-256: Decode the Bytes Before Hashing
Hash the bytes represented by Base64, compare that with hashing the encoded text itself, and use a byte-safe method when the decoded data is not UTF-8 text.
Define which of two inputs you intend to hash
Base64 to SHA-256 usually means decode the Base64 representation into its original bytes, then hash those bytes with SHA-256. Hashing the visible Base64 characters is a different operation. The distinction is part of the input contract, not an optional formatting choice. For example, YWJj represents the three bytes for the text abc, while the literal text YWJj contains four different ASCII bytes. Both can be hashed correctly, but the digests answer different questions. Establish which message the expected checksum describes before comparing results.
Check a small decoded-text example
Decoding YWJj gives abc. Hashing those three UTF-8 bytes produces ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad. For this particular example, use a Base64 decoder to obtain the text and then enter exactly abc in the local SHA-256 Generator. Do not include quotation marks, a label such as Decoded text or an extra line break when copying the result. This two-step text workflow is valid because the decoded message is ordinary UTF-8 text and its bytes are preserved when the same text is encoded again.
Compare with hashing the Base64 characters
Entering YWJj directly into the SHA-256 text field produces 35d95694d3f160215db293c7899daa5907837838fb4b8119ed713e32446c1266. That different digest is expected: the generator is hashing the text supplied to it, not automatically detecting and decoding Base64. A sequence of letters that happens to be valid Base64 could also be an ordinary identifier. Automatic decoding would make the operation ambiguous. When documenting a result, state either SHA-256 of decoded bytes or SHA-256 of the Base64 text, rather than labelling both outputs simply Base64 hash.
Keep binary payloads out of a text-only round trip
The Base64 string AP8= represents two bytes, hexadecimal 00 and FF. They are not a valid UTF-8 text sequence. A decoder that expects text may reject the result or substitute a replacement character, and hashing that displayed replacement would no longer hash the original bytes. The SHA-256 of the original two bytes is 06eb7d6a69ee19e5fbdf749018d3d2abfa04bcbd1365db312eb86dc7169389b8. Use a byte-aware workflow for this case. The local SHA-256 Generator is a text tool and does not accept an arbitrary binary byte array or a Base64 payload as a distinct input type. An error message is not a replacement payload to hash.
Use a byte buffer in a programming workflow
In Node.js, Buffer.from(value, 'base64') creates decoded bytes. Pass that buffer directly to createHash('sha256').update(bytes).digest('hex') after importing createHash from node:crypto. Avoid an intermediate bytes.toString('utf8') unless the protocol specifically requires text interpretation and you have established that the data is valid UTF-8. The operation shown computes a digest of the buffer. It does not by itself establish that the supplied representation follows every canonical Base64 or application-level rule required by a protocol; validate those rules separately when they matter.
Keep the Base64 variant and transport rules explicit
An application may specify standard Base64, Base64url, optional padding or restrictions on line breaks. Follow the stated input format rather than silently rewriting arbitrary strings until a decoder accepts them. Node.js documents permissive aspects of its Base64 decoding, so successful decoding alone should not be used as proof that a strict external format was followed. If the value was extracted from a data URL, distinguish the metadata prefix from the encoded payload. The hash should cover exactly the bytes defined by the application, not a surrounding label or container accidentally included during copying.
Record both representation and digest meaning
A reproducible record includes the input representation, decoded byte count, algorithm and full digest. For the YWJj example, those are standard Base64, three decoded bytes and SHA-256 ending in 15ad. Retain the full digest for comparison; the shortened ending here only identifies the worked example. An independently calculated matching hash confirms agreement on the bytes under the chosen algorithm, but does not authenticate the source of the data or provide a way to reconstruct it from the digest. Keep decoding, hashing and source verification as separate steps with their own stated purpose.