Base64 to JavaScript
Decode Base64 strings commonly encountered in JavaScript workflows — API responses, atob() output, Buffer-encoded values, and JWT payload segments. Includes the equivalent JavaScript code snippets for browser and Node.js contexts.
Last updated: May 28, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is Base64 to JavaScript?
JavaScript developers encounter Base64 in many everyday situations: decoding values returned by atob(), reading Buffer-encoded data in Node.js, inspecting JWT payload sections, parsing data URIs, and decoding Basic Auth headers in HTTP clients.
This tool decodes any Base64 string instantly and provides the equivalent JavaScript code — atob() for browsers and Buffer.from() for Node.js — so you know exactly how to reproduce the decode in your own code.
How to Use Base64 to JavaScript
Paste the Base64 string into the input field
Click "Decode" to recover the original text
Enable URL-safe mode if the string uses - and _ instead of + and /
Copy the decoded output or use the provided JS code snippet in your project
Common Use Cases
- Frontend developers decoding Base64 values returned by APIs or stored in localStorage and cookies.
- Node.js engineers decoding Buffer-encoded strings in data pipelines or file processing scripts.
- JavaScript developers inspecting the payload section of a JWT token (the middle Base64url segment).
- Web developers decoding data URIs to inspect the embedded content type and raw data.
- Security engineers reading Base64-encoded credentials or tokens in captured HTTP traffic.
Example Input and Output
Decoding a Base64-encoded configuration object passed as a URL parameter in a JavaScript application.
eyJlbnYiOiJwcm9kdWN0aW9uIiwiZGVidWciOmZhbHNlfQ=={"env":"production","debug":false}Node.js Buffer
In Node.js, use Buffer.from(str, "base64").toString("utf8") rather than atob(), which is only available in browser globals and modern Node.js 16+.
Browser-side only
Decoding runs locally in your browser. Nothing is transmitted.

