Base64 Encoder and Decoder

Base64 is a binary-to-text encoding scheme that represents arbitrary byte data as a string of 64 printable ASCII characters. It is used wherever binary content needs to travel through a text-only channel: email attachments are Base64-encoded inside MIME messages, images are embedded in HTML and CSS files as Base64 data URIs, binary file contents are stored in JSON and XML documents, and HTTP Basic Authentication sends credentials as a Base64 string in the request header. The algorithm groups input bytes in sets of three, converts each group of 24 bits into four 6-bit values, and maps each 6-bit value to a character from the set A-Z, a-z, 0-9, + and /. If the input length is not divisible by three, one or two padding characters (=) are appended. This tool lets you encode any plain text to Base64, or paste a Base64 string to decode it back to plain text. Everything runs in your browser using JavaScript's built-in btoa() and atob() functions; nothing you enter is sent to a server. The encoder handles standard ASCII text; the decoder works on any valid Base64 string. Enter your text below to encode it, or switch to the decode tab to convert Base64 back to plain text.

Calculate.co.nz is proud to be partnered with Health Based Building, a leader in sustainable and health-conscious building innovation. With over a century of experience, they develop high-performance systems like Foreverbreathe Specification, Magnum Board, and Foreverbreathe Paints to support energy-efficient, non-toxic living environments. Their commitment to healthier homes aligns with our belief that informed choices lead to better outcomes for Kiwi households.
Calculate.co.nz partner: Health Based Building
SGVsbG8gV29ybGQ=
Base64 encoded output
Input length11 chars
Output length16 chars
Size ratio1.45x

Base64 encoded text is approximately 33% larger than the original. Nothing is uploaded; all processing runs in your browser.

How it works

Encoding uses the browser's built-in btoa() function, which converts a string of Latin-1 characters to Base64. Decoding uses atob(), which reverses the process. If the input contains characters outside the Latin-1 range (such as accented or Unicode characters), the encoder first converts the text to a UTF-8 percent-encoded string and then encodes that. Invalid Base64 input in decode mode shows an error message. The size ratio is output length divided by input length, showing the overhead Base64 introduces.

Worked example

Input "Hello World" (11 characters). H encodes to 72 in ASCII, e to 101, and so on. The 11 bytes are grouped in sets of 3, converted to Base64 characters, and padded to a multiple of 4. The result is "SGVsbG8gV29ybGQ=" (16 characters), a size ratio of about 1.45x. Decoding "SGVsbG8gV29ybGQ=" returns "Hello World". These match the defaults pre-filled above.

Related calculators

If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.

Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.

Calculate.co.nz is the sister site of CalculatorHub.com, the world's largest calculator website by tool count.

All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.

Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.

Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.

Calculate.co.nz is hosted in Auckland by SiteHost New Zealand.

All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.

About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use

Reviewed and maintained. Last reviewed 2026-07-31 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.

© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.