Passer au contenu principal

bin2hex

Convertissez des données binaires en chaînes hexadécimales et de l'hexadécimal en binaire au niveau octet — comme bin2hex() et hex2bin() de PHP.

Input
0 chars | 0 bytes
Encode
Output
0 chars | 0 bytes

The `bin2hex` operation — converting raw binary bytes to their hexadecimal string representation — is a fundamental operation in systems programming, cryptography, and network protocol work. It is how you print a byte array in a debugger, how you display a cryptographic hash, and how you serialise binary data for storage in a text field or transmission in a JSON payload.

This tool converts binary data (entered as raw text, where each character is treated as its byte value) to a hex string, and reverses the process to convert a hex string back to binary. It operates at the byte level, making it the right tool for working with file signatures, hash values, binary protocol fields, and any situation where you need to inspect or construct the exact byte-level content of a value.

Comment utiliser bin2hex en ligne

  1. 1

    Collez une entrée hexadécimale ou binaire

    Collez une chaîne hexadécimale pour voir la représentation en octets binaires, ou collez des octets encodés en hexadécimal pour les afficher sous forme de dump hexadécimal formaté.

  2. 2

    Inspectez les données au niveau octet

    Chaque octet est affiché sous forme de deux chiffres hexadécimaux. L'outil avertit automatiquement si un nombre impair de caractères hexadécimaux est saisi et complète avec un zéro à gauche.

  3. 3

    Copiez le résultat

    Copiez la sortie hexadécimale ou binaire pour l'utiliser dans du code, le débogage de protocoles ou les défis CTF.

How bin2hex Conversion Works

At the byte level, bin2hex is straightforward: each input byte is formatted as exactly two hex digits, zero-padded on the left if necessary, and the results are concatenated. The byte value 0 becomes `00`, 10 becomes `0a`, and 255 becomes `ff`. The output length is always exactly twice the input length in bytes — a predictable property that makes hex strings easy to work with programmatically: you can always extract byte N from a hex string by taking characters at positions `2N` and `2N+1`.

The reverse operation (hex-to-binary) splits the hex string into two-character groups, parses each as a base-16 integer, and emits the corresponding byte. Error handling is important: an odd-length hex string, a character outside `0-9a-fA-F`, or a value above `0xFF` in a group all indicate malformed input that must be rejected rather than silently truncated.

Pourquoi utiliser FileCrank bin2hex ?

  • ✓ Conversion hexadécimale au niveau octet correspondant au comportement de bin2hex() / hex2bin() de PHP.
  • ✓ Avertit et corrige automatiquement les entrées hexadécimales de longueur impaire.
  • ✓ Utile pour les charges utiles de protocoles, les sorties cryptographiques et les défis CTF.
  • ✓ Fonctionne entièrement dans votre navigateur — aucune donnée n'est envoyée à un serveur.

Fonctionnalités & Spécifications

Taille max. du fichier
Jusqu'à 100 Mo
Confidentialité
Conforme au RGPD : fichiers supprimés après environ une heure
Prix
Gratuit, sans inscription
Traitement
100% côté client
Vos données ne quittent jamais votre navigateur — tout le traitement est local.Aucun compte ni inscription requis.Gratuit sans limite d'utilisation.

Questions fréquentes

Quelle est la différence entre bin2hex et le convertisseur hexadécimal ?

Le convertisseur hexadécimal convertit des chaînes de texte lisibles vers et depuis l'hexadécimal. bin2hex convertit des données d'octets bruts — charges utiles de protocoles binaires, octets de fichiers, sortie cryptographique — qui peuvent ne pas former de texte valide. Utilisez bin2hex pour une inspection au niveau octet.

Que fait la fonction bin2hex() de PHP et puis-je la reproduire ici ?

La fonction bin2hex() de PHP prend une chaîne binaire et retourne une chaîne hexadécimale où chaque octet est représenté par deux chiffres hexadécimaux. Cet outil reproduit ce comportement. La chaîne 'A' (ASCII 65 = 0x41) s'encode en 41.

Pourquoi saisir un nombre impair de caractères hexadécimaux génère-t-il un avertissement ?

L'encodage hexadécimal représente toujours des octets complets — chaque octet est exactement deux caractères hexadécimaux. Un nombre impair signifie que le premier octet est incomplet. L'outil complète avec un 0 à gauche et affiche un avertissement pour signaler l'ajustement.

Cet outil est-il utile pour les défis CTF ?

Oui. De nombreux défis CTF impliquent des dumps hexadécimaux, des charges utiles binaires et des couches d'encodage. Cet outil gère la conversion hexadécimale au niveau octet rapidement dans le navigateur sans nécessiter d'outils locaux.

bin2hex vs. xxd vs. Python binascii

Python's `binascii.hexlify()` and `bytes.hex()` are the idiomatic in-code solution but require a script or REPL. The `xxd` command produces a formatted hex dump with address offsets and ASCII representation in columns — excellent for file inspection but verbose for extracting a single hex value. A browser-based bin2hex tool is the fastest option when you have a short binary string or hash value and need its hex form (or vice versa) right now, without writing code or opening a terminal.

FileCrank bin2hex convertit entre des données binaires et des chaînes hexadécimales au niveau octet, reproduisant les fonctions bin2hex() et hex2bin() de PHP, entièrement dans votre navigateur.

Advertisement

Ad