Toolivaro

Encodeur et décodeur Base64 gratuit

Encodez du texte ou des fichiers en Base64 et décodez-les, avec gestion de l'UTF-8, validation et statistiques de taille — entièrement local.

L'encodeur et décodeur Base64 travaille avec le texte et les fichiers, dans les deux sens. Encodez n'importe quel texte — ou n'importe quel fichier chargé depuis votre appareil — en Base64 RFC 4648, avec des statistiques exactes au niveau de l'octet (tailles d'entrée et de sortie, et surcoût d'encodage). Décodez du Base64 vers du texte lorsque les octets sont de l'UTF-8 valide, ou téléchargez les octets décodés sous forme de fichier lorsqu'ils ne le sont pas : les charges utiles binaires ne sont jamais mutilées en texte en silence. Le décodage est strict : les chaînes malformées (caractères hors alphabet, padding « = » mal placé, longueurs invalides) sont rejetées avec une raison précise au lieu de produire du texte dénué de sens. Tout s'exécute localement dans votre navigateur : le texte collé et les fichiers chargés ne quittent jamais votre appareil, ne sont jamais journalisés et ne sont jamais transmis — un point crucial lorsque la donnée est un jeton, un certificat ou une clé privée. Base64 est un encodage, pas un chiffrement : il rend la donnée sûre pour le texte, il ne cache rien. Utilisez cet outil pour intégrer des données dans des URL ou du JSON, pour déboguer des jetons, ou pour faire transiter des données binaires par des canaux qui n'acceptent que du texte.

Traité localement dans votre navigateur

Traité localement dans votre navigateur — la saisie n'est jamais envoyée, journalisée ni stockée. Base64 est un encodage, pas un chiffrement.

Comment utiliser cette calculatrice

Why Base64 exists — and when to reach for this tool

Base64 solves a transport problem, not a secrecy problem. Many channels — email bodies, JSON fields, URL query strings, HTTP headers, and plain-text boxes — are built for text, and some of them are picky about which text. Raw bytes, accented characters, nulls, and line breaks can be mangled in transit or rejected outright. Encoding converts those bytes into a safe alphabet of 64 characters (A–Z, a–z, 0–9, plus, and slash), so the payload survives the trip untouched. That is why tokens, certificates, API keys, and small binaries so often arrive as long strings ending in equals signs. Use this tool when you need to put binary data into a text-only channel, when you are debugging a token or a configuration value, or when something you were sent looks like Base64 and you want to see what it actually says before acting on it.

Knowing when not to use Base64 is half the skill. It adds no secrecy — anyone can decode it in seconds, and a JWT payload decoded here says nothing about whether the token is genuine. It also expands data by about a third, so it is the wrong tool for shrinking anything. Encode when a system demands it: an Authorization header, a data-URI, a config file that only accepts ASCII, or a paste into a form that drops binary files. Decode when you received a Base64-looking string — from a log line, an email, or a chat — and you want to read the actual content before acting on it. Everything you type or load is processed entirely in your browser; the page never uploads, logs, or stores your input, which matters when the data is a credential.

Encoding and decoding: fields, buttons, and strictness

The tool has one input box, two direction buttons, and a file loader. Type or paste your text into the box and press Encode to turn it into Base64; paste a Base64 string and press Decode to get the text back. The same box also accepts files: choose one from your device and the tool reads it as bytes, encodes the whole thing, and places the result back in the box — so you can encode a small PDF, an image, or a key file without ever opening it. The output box shows the result, the Copy button copies it ready for a header or a config field, and Clear wipes both boxes and the size comparison so you can start over. A size bar underneath compares input and output, updating with every encode or decode, and the download button appears only when decoding produced binary bytes.

Two pitfalls matter. First, decoding is strict on purpose: a string whose length is not a multiple of four, characters outside the 64-symbol alphabet, or padding in the wrong place is rejected with a reason instead of silently producing garbage. If you copied the string from a URL, remember that URL-safe variants drop the trailing equals signs — paste the full string, padding included. Second, decoded bytes are shown as text only when they are valid UTF-8. If you decode a Base64-encoded image, archive, or key file, the page tells you the bytes are not text and offers a Download button that saves them as a file named decoded.bin. Use that button — copying the on-screen placeholder would hand you corrupted data, because the text box cannot represent those bytes exactly, and the round trip would never restore the original.

Reading the results: stats, overhead, and limits

After encoding, the tool reports byte statistics: the input size in bytes, the output length in characters, and the overhead percentage. The classic expansion is four output characters per three input bytes — about 33 percent — so the word Hello (5 bytes) becomes SGVsbG8= (8 characters, 160 percent of the input). Text with non-ASCII characters — accents, emoji, Cyrillic — is encoded as UTF-8 bytes first, so the reported input size is the byte count, not the character count, and a round trip restores the original text exactly. After decoding text, the stats line shows how many decoded bytes were produced and confirms that they are valid UTF-8. For binary payloads it shows the byte count together with the notice that the bytes are not text and should be downloaded rather than copied, which keeps the size of the payload visible either way.

The size bars give a visual comparison of input and output — expect the output bar to run about a third longer than the input, which is the price of text-safe transport. The limits are honest ones: this tool uses the standard RFC 4648 alphabet with padding, so URL-safe variants and unpadded strings are not a separate mode, and files are processed in memory, which keeps the tool responsive but means it is not built for multi-gigabyte archives. Base64 is not encryption, so treat encoded output as readable by anyone who sees it — encode nothing you would not paste into a public chat. When decoding fails, read the error message: it names whether the length, the characters, or the padding is at fault, and that almost always points at a copy-paste problem rather than something wrong with the data.

Comment le résultat est-il calculé ?

Décodage de la section charge utile d'un JWT

La section centrale d'un JWT est du JSON encodé en Base64. La décoder ici affiche la charge utile — mais cet outil ne fait que décoder : il ne vérifie jamais la signature. Le contenu décodé est affiché sans prétendre à aucune authenticité, c'est pourquoi la page avertit que décoder n'est pas valider.

Exemple d'entrée et de sortie
Entrée Valeur
base64 eyJ1c2VyIjogImFsaWNlIiwgInJvbGUiOiAiYWRtaW4ifQ==
Résultat {"user": "alice", "role": "admin"} (non vérifié — décoder n'est pas une authentification)

Encoding credentials for a Basic auth header

Your staging API is protected by HTTP Basic auth, and the runbook’s curl commands need an Authorization header of the form Basic <base64>. The credential pair is admin:live_Kx9mQ7d2 — pasting it into the header directly is invalid, because the scheme requires the pair to be Base64-encoded first. Type the pair into the tool’s input box, press Encode, and you get YWRtaW46bGl2ZV9LeDltUTdkMg==, with the stats line reading 19 bytes → 28 chars (147%) — the classic cost of making the pair text-safe. The analogy that keeps people honest: Base64 is packaging, not a lock. It puts the credential into a standard crate that every transport layer can carry, but the crate opens without a key, so the header is readable by anyone who intercepts it. That is why Basic auth is only ever used over HTTPS, and why you should treat the encoded string as carefully as the pair itself. Back in the runbook, the command becomes curl -H “Authorization: Basic YWRtaW46bGl2ZV9LeDltUTdkMg==” https://staging.example/api. Verify the request returns 200, and regenerate the value whenever the key rotates — the runbook should document that the header is a derived value, not a permanent secret. The stats line earns its place here too: 19 bytes → 28 chars (147 percent) means a header or config field with a length limit will take just over one and a half times the plain length of the pair, so you can predict whether the value fits before you paste it. If the server starts rejecting the header, decode the value here to confirm it still reads admin:live_Kx9mQ7d2 before you touch the server configuration, and note that the same flow applies to any username:password pair — the colon is the separator the scheme expects.

Exemple d'entrée et de sortie
Entrée Valeur
text admin:live_Kx9mQ7d2
Résultat YWRtaW46bGl2ZV9LeDltUTdkMg== — 19 bytes → 28 chars (147%)

A truncated string that fails strict validation

While reading a config file your colleague sent over chat, you find a Base64 string that should hold a hostname — but decoding fails with Invalid Base64: length is not a multiple of 4. The string reads SGVsb, which is a truncated form of SGVsbG8=, the encoding of Hello: somewhere in the copy-paste hop the last three characters were cut off. The strict decoder checks the shape before it trusts the content, the way a jigsaw puzzle lets you see a missing piece before you start assembling. Each group of four Base64 characters encodes exactly three bytes, so a string whose length leaves a remainder of one when divided by four can never be valid — a lone leftover character would hold fewer bits than the alphabet can represent. Instead of guessing, the tool refuses with a specific reason, and that message is the useful part: it names the length as the problem, which points at truncation rather than a wrong character or a bad paste. Paste the complete SGVsbG8= and the decode succeeds, showing Hello as valid UTF-8 text with a stats line of 5 decoded bytes. Base64 strings often end in one or two equals signs, and chat apps, terminals, and email clients have all been known to eat them — treat the padding as part of the data. This is the honest behavior of the tool: bad input produces a clear explanation, never silent garbage, which is the opposite of a lenient decoder that would return a shortened or scrambled result and leave you debugging a server against the wrong value.

Exemple d'entrée et de sortie
Entrée Valeur
base64 SGVsb
Résultat Invalid Base64: length is not a multiple of 4.

Quelle est la formule et ses hypothèses ?

Encodage

base64 = 4 chars per 3 bytes, padded with "="

Termes de la formule
Symbole Signification
3 bytes chaque groupe de 3 octets donne 4 caractères Base64
padding « = » complète le dernier groupe pour atteindre un multiple de 4

Le texte est d'abord encodé en octets UTF-8 : les caractères non ASCII traversent l'aller-retour sans aucune altération.

Surcharge de taille

output size ≈ input size × 4/3, rounded up to a multiple of 4

Termes de la formule
Symbole Signification
4/3 le facteur d'expansion classique de Base64

Quelles sont les erreurs les plus courantes ?

  • Traiter Base64 comme un chiffrement et y stocker des secrets — l'encodage est trivialement réversible.
  • Décoder des charges utiles binaires comme du texte et copier une sortie corrompue — utilisez l'action de téléchargement pour les octets non UTF-8.
  • Supposer qu'un JWT décodé est authentique — décoder n'est pas vérifier la signature.

Quelles sont les hypothèses et les limites ?

  • L'encodage est le Base64 standard RFC 4648 avec padding ; les variantes sûres pour les URL sont un mode séparé, absent de la version 1.
  • Le décodage en texte exige de l'UTF-8 valide ; les autres encodages passent par le téléchargement du fichier.
  • Les fichiers volumineux sont traités en mémoire — l'outil est conçu pour des charges utiles classiques, pas pour des archives de plusieurs Go.

D'où viennent les chiffres ?

Dernière révision 12 août 2026 · Version 1.1.0 · Toolivaro ne garantit pas les contenus externes.

Questions fréquentes

Base64 est-il un chiffrement ?

Non. Base64 est un encodage qui rend les données binaires sûres pour le texte ; il n'apporte aucune confidentialité. Quiconque voit le texte encodé peut le décoder instantanément. Ne traitez jamais Base64 comme un moyen de protéger des données.

Pourquoi ne puis-je pas décoder certaines chaînes en texte ?

Les octets décodés peuvent ne pas être de l'UTF-8 valide — par exemple une image ou une archive encodée. Le décodeur le détecte et propose les octets sous forme de fichier à télécharger au lieu de les corrompre en texte.

Décoder un JWT le vérifie-t-il ?

Non. N'importe quel décodeur Base64 peut lire la charge utile d'un JWT ; c'est la signature qui prouve l'authenticité, et sa vérification exige la clé de l'émetteur. Un jeton décodé ne vous apprend rien sur son authenticité.

Can I encode a file, or only text?

Both. The file control reads a file from your device as bytes and encodes the whole thing into the input box, so you can encode a small PDF, an image, or a key file without opening it — the stats line shows the byte count and the resulting character count. Files are processed in memory, so the tool is designed for typical payloads rather than multi-gigabyte archives.

Does the tool accept Base64 with line breaks or spaces?

Yes. Whitespace — spaces, tabs, and line breaks — is stripped before validation, so a string wrapped across lines in an email or a terminal decodes correctly. Only whitespace is ignored: any other stray character, such as a quote mark or a hyphen, is rejected, because the strict check trusts only the 64 standard symbols and the equals-sign padding. If you are pasting from a message app, the line breaks are fine to leave in.

Why does my decode fail even though the string looks valid?

Three things are checked in order: the length must be a multiple of four (after stripping whitespace), every character must belong to the 64-symbol alphabet, and padding must sit only at the end. A string cut off mid-copy usually trips the length check; a stray dash or underscore trips the alphabet check — URL-safe Base64 uses those characters and is not supported here. The error message names the failing check, which tells you what to fix in the pasted string.

Fait partie de Outils de mots de passe, hachage et sécurité

Vous avez repéré une erreur ou souhaitez une correction ? Signalez-la — chaque correction est examinée.

Ce calculateur vous a été utile ?

Relu par l'équipe éditoriale de Toolivaro selon notre méthodologie Méthodologie · Politique éditoriale