The official node.js documentation for Buffer is the best place to check for something like this. As previously noted, Buffer currently supports these encodings: 'ascii', 'utf8', 'utf16le'/'ucs2', 'base64', 'base64url', 'latin1'/'binary', and 'hex'.

Answer from mscdex on Stack Overflow
🌐
Educative
educative.io › answers › what-is-the-nodejs-buffertostring-method
What is the Node.js Buffer.toString() method?
In Node.js, the Buffer.toString() method is used to decode or convert a buffer to a string, according to the specified character encoding type. Converting a buffer to a string is known as encoding, and converting a string to a buffer is known ...
🌐
GeeksforGeeks
geeksforgeeks.org › node-js-buffer-tostring-method
Node.js Buffer.toString() Method | GeeksforGeeks
October 13, 2021 - Buffer.toString( encoding, start, end ) Parameters: This method accept two parameters as mentioned above and described below: encoding: The format in which the buffer data characters has to be encoded.
🌐
Node.js
nodejs.org › api › buffer.html
Buffer | Node.js v26.10.0 Documentation
If no character encoding is specified, UTF-8 will be used as the default. import { Buffer } from 'node:buffer'; const buf = Buffer.from('hello world', 'utf8'); console.log(buf.toString('hex')); // Prints: 68656c6c6f20776f726c64 console.log(buf.toString('base64')); // Prints: aGVsbG8gd29ybGQ= ...
🌐
Mastering JS
masteringjs.io › tutorials › node › buffer-to-string
Using the Buffer `toString()` Function in Node.js - Mastering JS
August 21, 2020 - By default, toString() converts the buffer to a string using UTF8 encoding.
🌐
W3Schools
w3schools.com › nodejs › met_buffer_tostring.asp
Node.js buffer toString() Method
The toString() method returns the buffer object according to the specified encoding.
🌐
TutorialsPoint
tutorialspoint.com › nodejs › nodejs_buffer_tostring_method.htm
Node.js - Buffer.toString() Method
By default, the encoding used is 'utf-8'. Following is the syntax of the Node.JS Buffer.toString() Method −
🌐
DEV Community
dev.to › angdecoder › demystifying-buffers-in-nodejs-d2c
Demystifying Buffers in Node.js - DEV Community
February 20, 2024 - e. Buffer.toString(encoding) --> This method converts a given buffer to string with given encoding. DEFAULT ENCODING : UTF-8 · const { Buffer } = require('buffer'); const buff8 = Buffer.from('hello'); console.log(buff8.toString()); // OUTPUT ...
🌐
Adeva
adevait.com › nodejs › convert-node-js-buffer-to-string
How to Convert Node.js Buffer to String | Toptal®
May 26, 2026 - In a nutshell, it’s easy to convert a Buffer object to a string using the toString() method. You’ll usually want the default UTF-8 encoding, but it’s possible to indicate a different encoding if needed.
Find elsewhere
🌐
Medium
medium.com › @ryan_forrester_ › buffer-to-string-in-javascript-how-to-guide-b24027575419
Buffer to String in JavaScript (How To Guide) | by ryan | Medium
January 7, 2025 - The buffer is created with utf8 encoding. The buffer is then converted to a hexadecimal string using the toString method with 'hex' encoding.
🌐
W3Resource
w3resource.com › node.js › nodejs-buffer.php
Using Buffers in Node.js - w3resource<
November 13, 2023 - Here is an another example where we have added all three arguments, the second argument indicates an offset. buf.toString([encoding], [start], [end]) The buf.toString([encoding], [start], [end]) method decodes and returns a string from buffer data.
🌐
Bun
bun.sh › binary data › convert a buffer to a string
Convert a Buffer to a string - Bun
August 4, 2026 - const buf = Buffer.from("hello"); const str = buf.toString(); // => "hello" You can optionally specify an encoding and byte range. const buf = Buffer.from("hello world!"); const str = buf.toString("utf8", 0, 5); // => "hello" See Binary Data.
🌐
Readthedocs
node.readthedocs.io › en › latest › api › buffer
Buffer - node - Read the Docs
If encoding is undefined or null, then encoding defaults to 'utf8'. The start and end parameters default to 0 and buffer.length when undefined. buf = new Buffer(26); for (var i = 0 ; i < 26 ; i++) { buf[i] = i + 97; // 97 is ASCII a } buf.toString('ascii'); // outputs: abcdefghijklmnopqrstuvwxyz ...
🌐
GitHub
github.com › oven-sh › bun › issues › 455
Buffer#toString unexpected / incorrect results with encoding · Issue #455 · oven-sh/bun
July 8, 2022 - // node prints [ 65 ] while bun prints [ 65, 209 ] console.log(Buffer.from([65, 0]).toString("utf16le").split("").map(x => x.charCodeAt(0))); NodeJS prints the expected [ 65 ] (one character, 0x41 == 65) but Bun generates two characters [ 65, 209 ] B) base64 encoding does not include padding: // bun and node both print QQA console.log(Buffer.from([65, 0]).toString("base64url")) // node prints QQA= with the padding while bun omits the padding console.log(Buffer.from([65, 0]).toString("base64")) As noted in the NodeJS docs, base64url omits padding while base64 includes padding.
Author: oven-sh
🌐
GitHub
github.com › nodejs › node › issues › 12908
Can't convert Buffer into String correctly with binary encoding · Issue #12908 · nodejs/node
May 8, 2017 - Hello, I was working with binary files and Buffer, and encountered this problem. Code: b = Buffer.from([0xca, 0xc5, 0x0e]) console.log(b.toString('binary')) console.log(b) I would expect as output something like: ÊÅ^N which is exactly th...
Author: nodejs
🌐
Bun
bun.com › modules › node:buffer › buffer › tostring
Buffer.toString method | Node.js buffer module | Bun
May 21, 2026 - toString( encoding?: BufferEncoding, start?: number, end?: number · ): string; Decodes buf to a string according to the specified character encoding inencoding. start and end may be passed to decode only a subset of buf.
🌐
Sabe
sabe.io › blog › node-buffer-tostring
How to use the Buffer toString Function in Node - Sabe.io
August 29, 2022 - By default, the toString() method will convert the buffer to a string using the default encoding, however, you can specify the type of encoding that you want by passing it as an argument.
🌐
Medium
medium.com › @ks.deepak07 › understanding-node-js-buffers-69b0adae2005
Understanding Node.js Buffers | by Deepak Kumar Singh | Medium
May 4, 2025 - The toString() method returns a string form of the buffer according to the specified encoding.
🌐
Google Groups
groups.google.com › g › nodejs › c › 89JMthbHCvw
buffer toString with partial utf8 character?
September 3, 2014 - If you want to be sure, you can use StringDecoder#detectIncompleteChar(). It's not documented but it takes a buffer as its argument: var buffer = /* ... */; var StringDecoder = require('string_decoder').StringDecoder; var dec = new StringDecoder('utf8'); dec.detectIncompleteChar(buffer); if (dec.charReceived < dec.charLength) { // Partial character sequence. } You can also implement the algorithm yourself if you don't want to depend on an undocumented function. UTF-8 is a self-synchronizing run-length encoding; you can figure out the length of the character by looking at the last one to three bytes.