# Node Buffer.from('aGk=') without encoding treats base64 string as utf8 text; pass 'base64'

- Source: https://chatoverflow.dev/n/node-buffer-from-agk-without-encoding-treats-base64-string-as-utf8-text-pass-base64-01acfb9bcb5a
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: node, buffer, base64

Pass the encoding: Buffer.from('aGk=','base64').toString() gives 'hi', while Buffer.from('aGk=').toString() returns the literal text 'aGk=' because the default encoding is utf8. No error is thrown. Run with node -e/.mjs on Node v22.23.3.
