Base64 to Integer Converter

Converts a list of strings (one per line) encoded with this site's own integer/Base64 scheme back into integers: strips an optional leading "-", Base64-decodes the rest to bytes, and interprets them as a big-endian unsigned magnitude before reapplying the sign. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-27

Overview

Introduction

This tool reverses this site's own integer/Base64 scheme (see the Integer to Base64 Converter), turning encoded strings back into their original integers.

It strips an optional sign prefix, decodes the remaining Base64 text to bytes, and reconstructs the number from those bytes.

What Is Base64 to Integer Converter?

A converter that takes Base64-encoded strings, one per line, each optionally prefixed with "-", and outputs the integer each one represents.

It's the direct inverse of the Integer to Base64 Converter and only understands that specific scheme, not any general-purpose binary-integer encoding.

How Base64 to Integer Converter Works

Each line has an optional leading "-" stripped off and remembered as the sign.

The remaining text is Base64-decoded into raw bytes.

Those bytes are interpreted as a big-endian unsigned magnitude (each byte shifting the accumulated value up by a factor of 256), then the remembered sign is reapplied.

When To Use Base64 to Integer Converter

Use it to decode values produced by the companion Integer to Base64 Converter.

It's also useful for understanding how byte arrays map back to integers in a big-endian scheme.

Features

Advantages

  • Directly reverses this site's compact integer/Base64 scheme with no ambiguity.
  • Rejects malformed Base64 clearly instead of silently producing garbage.

Limitations

  • Only understands this site's specific scheme; it won't correctly decode arbitrary Base64 data from other formats as an integer.
  • Limited to values within JavaScript's safe integer range.

Examples

Positive value

Input

/w==

Output

255

Negative value

Input

-/w==

Output

-255

Best Practices & Notes

Best Practices

  • Only feed this tool strings produced by the matching Integer to Base64 Converter, since it isn't a general Base64-to-number decoder.

Developer Notes

Bytes are reconstructed with `value = value * 256 + byte` across the decoded byte array (a standard big-endian accumulation), and the result is checked with `Number.isSafeInteger` before the sign is reapplied, to catch precision loss on very large inputs.

Base64 to Integer Converter Use Cases

  • Decoding values produced by the Integer to Base64 Converter
  • Verifying round-trip correctness of the site's integer/Base64 scheme
  • Teaching how byte arrays map back to big-endian integer values

Common Mistakes

  • Feeding in Base64 from an unrelated source (like a file or JSON string) and expecting a meaningful integer back.
  • Forgetting the leading "-" when re-entering a negative value that was encoded earlier.

Tips

  • Round-trip a value through the Integer to Base64 Converter and back through this tool to confirm you understand the scheme.

References

Frequently Asked Questions