ASCII to Hex String Converter Online Tool


Hex Delimiter


About ASCII to Hex String Converter Online Tool:

This online ASCII to Hex string converter tool helps you to convert one input ASCII string into a Hex (base 16) String.

The Hex string delimiter can be chosen from ("", " ", "0x", "0X", "\0x", "\0X", "\x", "\X").

ASCII Encoding Standard:

ASCII (American Standard Code for Information Interchange) is the most widely used character encoding standard. The standard ASCII has 7 bits, 128 distinguish characters. The extended ASCII has 8 bits, 256 distinguish characters. The Copyright Symbol © that you see everyday is in the extended ASCII list.

Hex Numeral System:

Hex numeral system (also called hexadecimal) has 16 digits, include (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) just like decimal numeral system, plus (a, b, e, d, e, f) 6 additional characters. Which means it's is a number system of base 16. Since Hex numeral system can represent any binary string in a readable way, It is widely used in computer science. The SHA256 hash string is often appears as Hex style string, the Color System used in HTML is also be written down as Hex number, from #000000 (pure black) to #FFFFFF (pure white).

comic ascii to hex

More information:

Wikipedia (Hexadecimal): https://en.wikipedia.org/wiki/Hexadecimal

Wikipedia (ASCII): https://en.wikipedia.org/wiki/ASCII

Convert ASCII to Hex String with Python:

import binascii


def ascii_to_hex(ascii_str):
    hex_str = binascii.hexlify(ascii_str.encode())
    return hex_str


ascii_input = 'This is an example.'
hex_output = ascii_to_hex(ascii_input)
print('hex result is:{0}'.format(hex_output))

-------------------
hex result is:b'5468697320697320616e206578616d706c652e'

Convert ASCII to Hex String with Java:

public class NumberConvertManager {
    public static String ascii_to_hex(String ascii_str) {
        StringBuilder hex_str = new StringBuilder();
        for (char ch : ascii_str.toCharArray()) {
            hex_str.append(Integer.toHexString((int) ch));
        }
        return hex_str.toString();
    }

    public static void main(String[] args) {
        String ascii_input = "This is an example.";
        String hex_output = ascii_to_hex(ascii_input);
        System.out.println("hex result is:" + hex_output);
    }
}

-------------------
hex result is:5468697320697320616e206578616d706c652e