Przejdź do treści głównej
FreeOnlineTools Go
Polski
how-to

Jak Kodować i Dekodować Stringi Base64 Krok po Kroku

By FreeOnlineTools Team · Updated 2026-09-02

Quick Answer

Aby zakodować Base64: wklej tekst do Base64 Encoder i zakodowany ciąg pojawia się natychmiast. Aby zdekodować Base64: wklej ciąg Base64 do Base64 Decoder i oryginalny tekst pojawia się. Całe przetwarzanie odbywa się lokalnie —dane nigdy nie są uploadowane.

Introduction

Base64 to schemat kodowania binarnego-na-tekst, który konwertuje dane binarne na ciąg ASCII używając 64 drukowalnych znaków (A-Z, a-z, 0-9, +, /). Jest szeroko używany w załącznikach email, Data URLs, tokenach JWT i payloadach API. Base64 to odwracalne kodowanie, nie szyfrowanie —każdy może zdekodować bez klucza.

Step by Step

  1. Open the Base64 tool

    Go to the Base64 Encode & Decode tool page. The tool has two modes: Encode and Decode, selectable via tabs or a toggle.

  2. Enter your input text

    In Encode mode, paste or type the text you want to encode into the input textarea. Any text works — plain strings, JSON, URLs, or even emoji (the tool handles UTF-8 correctly).

  3. Read the Base64 output

    The tool encodes your input instantly using the browser's built-in btoa() function with UTF-8 handling. The Base64 output appears in the result field automatically — no button to click.

  4. Copy the encoded string

    Click the Copy button next to the output field to copy the Base64 string to your clipboard. You can now paste it into your API call, HTML Data URL, or config file.

  5. Decode Base64 back to text

    Switch to Decode mode and paste a Base64 string into the input field. The tool decodes it using atob() with UTF-8 support and shows the original text instantly. If the input is not valid Base64, an error message appears.

Examples

Encode a simple greeting

Input: Hello, World!

Output: SGVsbG8sIFdvcmxkIQ==

Encode JSON data

Input: {"user":"alice","id":42}

Output: eyJ1c2VyIjoiYWxpY2UiLCJpZCI6NDJ9

Decode a Base64 token

Input: SGVsbG8gV29ybGQ=

Output: Hello World

Encode Unicode text with emoji

Input: Hello 🌍

Output: SGVsbG8g8J+MjQ==

Common Problems

  • Non-ASCII characters produce wrong output —use a tool with UTF-8 support like ours; naive btoa() throws on emoji.
  • Base64 output is ~33% larger than the input —every 3 bytes becomes 4 Base64 characters.
  • Padding characters (= or ==) at the end are required —removing them breaks decoding.
  • Base64 is not encryption —anyone can decode it. Never store passwords or secrets as Base64.

Tips

  • Use Base64 for Data URLs to embed small images directly in HTML or CSS without a separate HTTP request.
  • For URL-safe Base64 (used in JWT), replace + with - and / with _, then strip padding.
  • Always validate decoded output before using it in your application —a corrupted Base64 string may decode to garbage.
  • Use our Base64 Encoder and Decoder tools for instant, private processing —no data leaves your browser.

Related Tools

Related Guides

References