Convert Text to Hexadecimal (Hex) and Hex to Text
Text to Hexadecimal (Hex) and Hexadecimal (Hex) to Text Translator
Paste or upload your text or Hexadecimal (Hex) data to respective textbox and click button to convert
Text to Hexadecimal and Hex to Text: The Complete Translator Guide
From source code to blockchain addresses, hex is everywhere text meets machine. Learn to convert text to hex and hex back to text by hand, in JavaScript, and instantly with our free online translator.
01Introduction
If binary is how computers think, hexadecimal is how humans prefer to read what computers are thinking. Text to hexadecimal conversion — and its reverse, hexadecimal to text conversion — is the process of representing readable characters as their compact hex byte values, and it's one of the most practically useful encoding skills in modern computing, web development, and even cryptocurrency.
You've likely brushed up against text-hex conversion without fully realizing it: a URL containing strange codes like %20, a source file with an escape sequence like \x48\x69, a blockchain wallet address starting with 0x, or a file signature identified by its first few hex bytes during forensic analysis. All of these rely on the same underlying principle — every character has a numeric code, and that code can be represented compactly in hexadecimal, using exactly two hex digits per byte.
This guide covers everything you need: what hexadecimal is, how text-hex encoding and decoding work, step-by-step manual conversion methods, how hex is used in programming and JavaScript specifically, real-world applications, a full reference table, hex's central role in blockchain technology, and how to use our free Text to Hex and Hex to Text Conversion Tool — also known as a hexadecimal translator — to convert instantly whenever you need it.
Fig 1.1 — "Hi" encoded to hexadecimal, then decoded back to text
Whether you're a developer decoding a debug log, a student learning character encoding, or someone curious about what those long 0x... strings in a crypto wallet actually mean, this guide takes you from the underlying theory through to fast, confident, real-world application.
Along the way, we'll build directly on concepts from our companion guides on hexadecimal number conversion and text-to-binary conversion, so if either of those topics feels unfamiliar, they're excellent companion reading alongside this guide.
02What is a Hexadecimal?
Hexadecimal ("hex" for short) is a base-16 number system that uses sixteen digit symbols: 0 through 9, followed by the letters A through F to represent the values 10 through 15. Unlike decimal (which humans naturally use) or binary (which computer hardware naturally uses), hexadecimal exists purely as a convenient bridge between the two — a compact, human-readable shorthand for binary data.
The reason hex is so well suited to this bridging role comes down to a clean mathematical relationship: since 16 equals 2⁴, exactly one hex digit represents 4 binary bits, and two hex digits together represent exactly one byte (8 bits) — the standard unit that nearly all modern computing is built around. This means any byte of data, whether it's part of a text character, an image file, or a network packet, can always be written using exactly two hex characters, with values ranging from 00 to FF.
Fig 2.1 — One byte of binary always converts to exactly two hex digits
When applied to text, this byte-aligned property means every character — which is typically stored as exactly one byte under ASCII encoding — maps to exactly one two-digit hex value. This one-to-one, fixed-width relationship is what makes hex such a clean, predictable format for representing text, and it's the foundational concept behind everything else covered in this guide.
03Text to Hexadecimal (Hex) Encoding
Encoding text to hex means converting each character in a string into its two-digit hexadecimal ASCII value. The process has three simple steps per character: look up the character's decimal ASCII code, convert that decimal code to hexadecimal, and pad the result to exactly two digits if needed.
Let's walk through encoding the word "Hi" into hex:
Just as with binary encoding, capitalization matters here too — 'H' (72, hex 48) and 'h' (104, hex 68) have entirely different hex values, since they're different characters with different ASCII codes. Spaces and punctuation encode the same way: a space character (decimal 32) becomes hex 20, which is exactly why you'll sometimes see spaces represented as %20 in URLs — that's hex 20, prefixed with a percent sign to signal "this is an encoded byte," a convention called percent-encoding or URL encoding.
In practice, hex-encoded text is often written without spaces between byte pairs (like 4869 instead of 48 69), since the fixed 2-digit-per-character width makes it easy to split correctly even without separators — a convenient property that binary-encoded text (with its 8-digit groups) shares as well.
04Hexadecimal (Hex) to Text Decoding
Decoding reverses the process: taking a hex string, splitting it into 2-character pairs, converting each pair to its decimal value, and looking up which ASCII character that decimal value represents. Because hex is so compact and byte-aligned, this decoding process is often faster and less error-prone than the equivalent binary decoding process.
Let's decode the hex string 48 69 back into text:
As with all reversible encoding schemes, decoding is simply encoding run backward using the same lookup table. Encoding a message and immediately decoding your own result should always return you to the exact original text — a useful sanity check whenever you're working through a conversion by hand.
05How to Convert a Text to Hexadecimal (Hex) Manually
Converting a full string to hex by hand is the single-character encoding process repeated in order for every character in your text. Here's the complete step-by-step method:
- Write out each character of your string individually, including spaces and punctuation, in their original order.
- Look up each character's decimal ASCII code using a reference table (see the full tables later in this guide).
- Convert each decimal code to hexadecimal using the repeated-division-by-16 method, padding with a leading zero if the result is only one digit.
- Combine the 2-digit hex values in order, optionally separated by spaces for readability.
Worked Example: Convert "Cat" to Hex
If you need a refresher on the repeated-division-by-16 method itself, it's the same decimal-to-hexadecimal technique used for converting any whole number — remembering to write remainders of 10 and above as letters (A–F) rather than two-digit numbers. The only extra step here is looking up each character's ASCII code first, before applying that familiar base-16 conversion process.
Fig 5.1 — Encoding each letter of "Cat" independently into 2-digit hex
06How to Convert a Hexadecimal (Hex) to Text Manually
Converting hex back into readable text follows the same logic in reverse. Here's the complete step-by-step method:
- Split the hex string into pairs of 2 digits each, working from left to right (each pair represents one character).
- Convert each 2-digit pair to its decimal value using the positional-value method (multiplying each hex digit by the appropriate power of 16 and summing).
- Look up each decimal value in the ASCII table to find its corresponding character.
- Combine the characters in order to reconstruct the original text string.
Worked Example: Decode 43 61 74
As expected, this brings us right back to "Cat" — confirming our earlier encoding was accurate. This kind of round-trip check is one of the best ways to build confidence with manual hex conversion before attempting longer strings by hand.
07How is Text to Hexadecimal Encoding Used in Programming?
Hex encoding shows up throughout software development in ways that are easy to overlook once you're used to seeing them. Here's where it appears most often in day-to-day programming work.
String and Character Escape Sequences
Many programming languages let you embed a character directly by its hex value using an escape sequence like \x48 (representing 'H') inside a string literal. This is especially useful for inserting non-printable characters, special symbols, or precisely controlled byte sequences that would be awkward or impossible to type directly on a keyboard.
URL and Percent-Encoding
Web addresses can only safely contain a limited set of characters. Anything outside that set — spaces, non-English characters, certain punctuation — gets converted to its hex byte value and prefixed with a percent sign, a scheme called percent-encoding. A space becomes %20, an ampersand becomes %26, and so on, ensuring URLs remain valid and unambiguous across every browser and server.
Byte Arrays and Binary Data Serialization
When a program needs to log, transmit, or store raw binary data (such as an image, a file, or a network packet) in a text-friendly format, it's common to represent that data as a hex string — often called a "hex dump." This lets binary data be safely copied, pasted, or embedded in text-based formats like JSON or XML without corruption.
Debugging and Logging
Developers frequently convert strings to hex when debugging encoding issues, comparing byte-for-byte differences between two pieces of text, or verifying that a file was read correctly at the byte level — hex output makes subtle differences (like invisible whitespace or encoding mismatches) immediately visible that would otherwise be impossible to spot in plain text.
Cryptography and Hashing
Cryptographic functions operate on raw binary data, and the standard convention for displaying their output — hash digests, encryption keys, digital signatures — is hexadecimal, precisely because it's the most compact and unambiguous way to represent arbitrary binary data as readable text.
Fig 7.1 — Text-hex encoding across common programming contexts
08How to Convert Text to Hex in JavaScript
JavaScript makes text-hex conversion straightforward using the same core method as text-binary conversion, just with a different base argument. The charCodeAt() method returns a character's decimal code, and calling .toString(16) converts it to hexadecimal instead of binary.
Text to Hex in JavaScript
Just like the binary version, .padStart(2, '0') is essential here — without it, a character with a small ASCII code (like a newline or tab) would produce only a single hex digit instead of the expected two, breaking the fixed-width pairing that hex-to-text decoding depends on.
Hex to Text in JavaScript
The second argument to parseInt() — the number 16 — tells JavaScript to interpret the string as base-16 (hexadecimal) rather than base-10 (decimal). This is the exact same function used in text-binary conversion, just with a different radix argument, which is a good illustration of how flexible and reusable this core JavaScript pattern really is across different number bases.
Fig 8.1 — The two core JavaScript functions for text-hex conversion, side by side
Node.js developers have an even more direct option using JavaScript's built-in Buffer class: Buffer.from("Hi").toString("hex") encodes to hex in a single line, and Buffer.from("4869", "hex").toString() decodes it back — a common shortcut in backend and server-side JavaScript code that avoids writing the manual character-mapping logic altogether.
09List of Text to Hexadecimal (Hex) and Hex to Text Applications and Uses
Text-hex conversion is genuinely practical across a wide range of technical fields. Here's where it shows up most often, with concrete examples of each.
Web Development
Beyond URL percent-encoding, hex appears throughout web development in CSS color codes (#2B2A4C), HTML character entities, and API payloads that need to safely transmit binary data (like uploaded file content) as text-safe hex strings.
File Signatures and Forensics
Every file format has a distinctive sequence of bytes at its very beginning, called a "magic number" or file signature, which is almost always documented and identified in hexadecimal. For example, PNG image files always begin with the hex bytes 89 50 4E 47, and forensic analysts use these signatures to identify file types even when a file's extension has been changed or removed.
Network Protocols
Low-level network packet analysis tools (like Wireshark) display raw packet contents in hex alongside their ASCII interpretation side by side, letting engineers see both the exact byte values and their human-readable meaning simultaneously when diagnosing network issues.
Data Recovery and Digital Forensics
Investigators examining raw disk sectors or memory dumps often work directly with hex editors, manually identifying readable ASCII text embedded within otherwise unreadable binary hex data — a technique closely related to the binary "string extraction" process covered in our companion guide on text-binary conversion.
Cryptography, Hashing, and Blockchain
As covered in detail later in this guide, hexadecimal is the standard format for displaying cryptographic hashes, encryption keys, and blockchain addresses and transaction identifiers — a role so central to modern cryptocurrency that understanding hex is practically a prerequisite for working with blockchain technology at any technical level.
Firmware and Embedded Systems
Microcontroller firmware is often distributed and flashed onto hardware using ".hex" files, a text-based format that represents the exact binary program code (including any embedded text strings) using hexadecimal notation, since it's both compact and reliably transmittable across serial connections.
Fig 9.1 — Text-hex conversion across real-world technical applications
10Hex, Decimal, Binary, ASCII Conversion Reference Table
This consolidated reference table brings together everything covered so far — a single character alongside its decimal ASCII code, hexadecimal value, and binary representation, all in one place for quick lookup during manual conversion work or debugging sessions.
| Character | Decimal | Hex | Binary |
|---|---|---|---|
| Space | 32 | 20 | 00100000 |
| ! | 33 | 21 | 00100001 |
| 0 | 48 | 30 | 00110000 |
| 9 | 57 | 39 | 00111001 |
| A | 65 | 41 | 01000001 |
| H | 72 | 48 | 01001000 |
| Z | 90 | 5A | 01011010 |
| a | 97 | 61 | 01100001 |
| i | 105 | 69 | 01101001 |
| z | 122 | 7A | 01111010 |
Keeping decimal, hex, and binary side by side like this makes the relationships between the three systems much easier to internalize — notice how the hex value is always exactly what you'd get by grouping the binary value into two 4-bit nibbles, a shortcut covered in depth in our dedicated hexadecimal conversion guide.
11Hex in Blockchain
If you've ever used a cryptocurrency wallet, you've seen hexadecimal in constant use, even if nobody explained why. Blockchain technology relies on hexadecimal so heavily that it's genuinely difficult to work with wallets, transactions, or smart contracts without running into it directly.
Wallet Addresses
Ethereum and other EVM-compatible blockchain addresses are 20-byte values, always displayed as 40 hexadecimal characters prefixed with 0x — for example, an address might look like 0xA1B2C3D4E5F60718293A4B5C6D7E8F9012345678. That 0x prefix is simply a widely adopted programming convention signaling "the characters that follow are hexadecimal," not part of the address's actual value.
Fig 11.1 — Structure of a typical hexadecimal blockchain wallet address
Transaction Hashes
Every blockchain transaction is identified by a unique transaction hash (often called a "txid"), which is the output of a cryptographic hash function — typically SHA-256 or Keccak-256 — represented in hexadecimal. These hashes are almost always exactly 64 hex characters long, since both algorithms produce a 256-bit (32-byte) output, and 32 bytes converts to exactly 64 hex digits.
Smart Contract Bytecode
When a smart contract is compiled and deployed to a blockchain like Ethereum, the compiled program logic is stored on-chain as raw bytecode, which is conventionally displayed and transmitted as one long hexadecimal string. Blockchain explorers let developers inspect this bytecode directly in hex form to verify exactly what logic a contract will execute.
Private Keys
A cryptocurrency private key — the secret value that proves ownership and authorizes transactions — is typically a 256-bit number, almost always displayed and stored as a 64-character hexadecimal string. Because a private key gives complete control over the funds it protects, understanding that it's "just" a very large hex number underscores why keeping it secret is so critical.
12Common Hex Values in Crypto
Certain hexadecimal values and patterns show up repeatedly across cryptocurrency systems. Recognizing them helps demystify what you're looking at when reviewing wallet activity or smart contract code.
The Null (Zero) Address
Ethereum and most EVM-compatible chains use a special "null address" — 40 consecutive hex zeros after the 0x prefix — to represent a non-existent or burned destination. Sending tokens to this address is a common, irreversible way of permanently removing them from circulation, since no private key exists that corresponds to an address of all zeros.
Function Selectors
When a smart contract function is called, the first 4 bytes (8 hex characters) of the transaction data identify exactly which function is being invoked — a value called a "function selector," derived by hashing the function's name and argument types and taking the first 4 bytes of the result. Wallets and blockchain explorers use these selectors to decode raw transaction data back into a human-readable function call.
Standard Hash Lengths
Regardless of which specific blockchain or hashing algorithm is used, most cryptographic hash outputs in the crypto space converge on a small handful of standard lengths in hex: 64 characters (256-bit hashes, the most common), 40 characters (160-bit values, often used for addresses), and occasionally 128 characters (512-bit hashes, used in some specialized cryptographic contexts). Recognizing these standard lengths at a glance helps you quickly identify what kind of value you're looking at, even without additional context.
| Value Type | Typical Hex Length | Underlying Bits |
|---|---|---|
| Wallet Address | 40 characters | 160 bits |
| Transaction Hash | 64 characters | 256 bits |
| Private Key | 64 characters | 256 bits |
| Function Selector | 8 characters | 32 bits |
| Null Address | 40 zero characters | 160 bits (all zero) |
13Common Mistakes to Avoid
- Forgetting to pad single-digit hex values. A character with a small ASCII code (like a tab or newline) converts to a single hex digit using simple division — always pad with a leading zero to reach exactly 2 digits per character.
- Mixing up uppercase and lowercase character codes. 'H' (hex 48) and 'h' (hex 68) are completely different values — always double-check case before looking up a character's hex code.
- Splitting a hex string into the wrong pair size. Standard ASCII hex-encoded text should always be split into pairs of exactly 2 digits during decoding — splitting into groups of any other size produces meaningless results.
- Confusing hex encoding with encryption. Converting text to hex makes it look unreadable at a glance, but it provides zero actual security — anyone with basic knowledge can decode it instantly. Never use hex encoding alone to protect sensitive information.
- Mistyping a single hex character in a crypto context. Unlike a typo in a text message, a single incorrect hex digit in a wallet address or transaction can send funds to the wrong destination permanently — always copy-paste or triple-check hex values in financial contexts rather than typing them manually.
- Skipping verification. Always decode your own encoded output (or vice versa) to confirm you land back on the original text — this simple round-trip check catches nearly every common manual conversion mistake.
14Hex to ASCII Text Conversion Table
Below is a reference table covering the uppercase alphabet along with its hexadecimal ASCII values — one of the most frequently needed lookups when converting hex to text by hand.
| Hex | Character | Hex | Character |
|---|---|---|---|
| 41 | A | 4E | N |
| 42 | B | 4F | O |
| 43 | C | 50 | P |
| 44 | D | 51 | Q |
| 45 | E | 52 | R |
| 46 | F | 53 | S |
| 47 | G | 54 | T |
| 48 | H | 55 | U |
| 49 | I | 56 | V |
| 4A | J | 57 | W |
| 4B | K | 58 | X |
| 4C | L | 59 | Y |
| 4D | M | 5A | Z |
For lowercase letters, simply add hex 20 to the corresponding uppercase value — for example, uppercase 'A' is hex 41, so lowercase 'a' is hex 41 + 20 = 61. This consistent offset mirrors the decimal 32-value gap between uppercase and lowercase letters covered in our companion guide on text-to-binary conversion, and it's one of the most useful patterns to internalize for fast manual hex decoding.
15Key Features of Our Hexadecimal (Hex) and Hexadecimal (Hex) to Text Conversion Online Tool
Manual conversion builds real understanding, but when you're working with longer messages or blockchain-length hex strings, our Text to Hex and Hex to Text Conversion Tool delivers instant, accurate results. Here's what makes it a reliable everyday utility for developers, students, and crypto users alike.
Instant, Real-Time Conversion
Type text or paste hex and see the converted result update immediately — no page reloads, no waiting.
Two-Way Translation
Convert text to hex and hex back to text in the same tool, without needing to switch between separate converters.
Handles Long Strings
Reliably processes long hex strings, including transaction hashes and full paragraphs of text, without truncation errors.
Free, Private & No Sign-Up
No account, subscription, or installation required. All conversions run directly in your browser with no data stored on our servers.
Mobile-Friendly Design
Fully responsive layout that works smoothly on desktops, tablets, and smartphones, so you can convert text wherever you're working.
One-Click Copy
Copy any converted output straight to your clipboard, ready to paste into your code, message, or documentation.
Unlike attempting the same conversion by hand — which requires flipping through an ASCII table character by character — this tool handles entire messages instantly, correctly manages spaces and punctuation, and eliminates the risk of a single mistyped hex digit throwing off an otherwise perfect message.
Whether you're debugging a byte-level encoding issue, decoding a blockchain transaction payload, or simply satisfying your curiosity about how a phrase looks in hex, having a dedicated converter on hand removes the tedious lookup work and lets you focus on the task itself.
16How to Use the Hexadecimal (Hex) and Hexadecimal (Hex) to Text Conversion Online Tool
Getting a conversion from our Text to Hex and Hex to Text Conversion Tool takes just a few seconds. Here's the full walkthrough:
- Open the tool by visiting onlinewebtoolkit.com/text-hex-converter in any browser — desktop or mobile.
- Choose your conversion direction — text to hex, or hex to text — depending on what you're starting with.
- Enter your text or hex into the input field. For hex input, use only digits 0–9 and letters A–F, in pairs.
- View the result instantly as it updates automatically while you type — no separate "Convert" button needed for basic use.
- Copy the output using the copy icon, ready to paste directly into your project, message, or notes.
Tips for Getting the Most Out of the Tool
A few small habits make the converter even more useful. If you're debugging an encoding issue in code, paste in both the expected and actual hex output side by side to visually spot exactly where they diverge. If you're learning to work with blockchain data, try decoding a sample transaction's hex payload to see how function selectors and parameters are packed together. And if you're just starting to learn hex, practice encoding a short phrase manually first, then verify your work against the tool — building genuine fluency with the base-16 lookup table pays off any time you need to read hex quickly without assistance, whether at a debugging desk or reviewing wallet activity.
Try the Hex Translator Now
Skip the manual lookup and get accurate text-to-hex and hex-to-text conversions in seconds.
Open the Free Tool →17Frequently Asked Questions
Look up each character's decimal ASCII code, convert that decimal number to hexadecimal using repeated division by 16, and pad the result to exactly 2 digits. Repeat for every character and combine the results in order.
Standard ASCII text represents each character using one byte, and one byte always converts to exactly 2 hex digits, since 16 squared (256) covers every possible byte value from 0 to 255.
The 0x prefix is a widely used programming convention that signals "the characters that follow should be interpreted as hexadecimal." It's not part of the actual value, similar to how a dollar sign indicates currency without being part of the number itself.
Addresses and hashes are fundamentally binary data (a fixed number of bytes), and hexadecimal is the most compact, standardized way to display that binary data as readable, copyable, unambiguous text.
Use charCodeAt() to get each character's decimal code, then call toString(16) to convert it to hex, padding to 2 digits with padStart(2, '0'). The reverse uses parseInt(hex, 16) paired with String.fromCharCode().
A file signature is a distinctive sequence of bytes at the very start of a file that identifies its format, conventionally documented in hexadecimal, such as PNG files always beginning with the hex bytes 89 50 4E 47.
No. Hex encoding is simply a different way of displaying the same data — it provides no security or confidentiality, since anyone can decode it instantly. Encryption, by contrast, actually transforms data using a secret key to make it unreadable without that key.
Most private keys are 256-bit numbers, and 256 bits converts to exactly 64 hexadecimal characters, since each hex digit represents 4 bits and 256 divided by 4 equals 64.
Both represent the same underlying ASCII byte values, just in different bases. Hex uses 2 characters per byte, while binary uses 8, making hex noticeably more compact and easier to read for longer strings.
Not using standard single-byte ASCII logic. Emoji and many non-English characters require Unicode encoding, typically UTF-8, which represents each character using a variable number of bytes rather than a fixed one byte per character.


Please Wait ...