Eric Bergman-Terrell's Blog

Node.js Programming Tip: How to Encode and Decode Base64 Text
August 21, 2015

Encoding and decoding Base64 text, in Node.js, is as easy as:

function base64Encode(text) {
    return new Buffer(text).toString('base64');
}

function base64Decode(text) {
    return new Buffer(text, 'base64').toString('utf8');
}

This code is used by my new online Base64 decoder/encoder utility.

For more details about manipulating base 64 data in Node.js, see Hack Sparrow's post.

encoding
What messages are encoded here?

Keywords: Node.js, node, Express, Javascript, Base64, Base 64, Encode, Decode

Reader Comments

Comment on this Blog Post

Recent Posts

TitleDate
.NET Public-Key (Asymmetric) Cryptography DemoJuly 20, 2025
Raspberry Pi 3B+ Photo FrameJune 17, 2025
EBTCalc (Android) Version 1.53 is now availableMay 19, 2024
Vault 3 Security EnhancementsOctober 24, 2023
Vault 3 is now available for Apple OSX M2 Mac Computers!September 18, 2023
Vault (for Desktop) Version 0.77 ReleasedMarch 26, 2023
EBTCalc (Android) Version 1.44 is now availableOctober 12, 2021