The question

"How can I convert a string to a hex value?"

is often asked, but it's not quite the right question. Better would be

"How can I convert a hex string to an integer value?"

The reason is, an integer (or char or long) value is stored in binary fashion in the computer.

"6A" = 01101010

It is only in human representation (in a character string) that a value is expressed in one notation or another

"01101010b"   binary
"0x6A"        hexadecimal
"106"         decimal
"'j'"         character

all represent the same value in different ways.

But in answer to the question, how to convert a hex string to an int

char hex[] = "6A";                          // here is the hex string
int num = (int)strtol(hex, NULL, 16);       // number base 16
printf("%c\n", num);                        // print it as a char
printf("%d\n", num);                        // print it as decimal
printf("%X\n", num);                        // print it back as hex

Output:

j
106
6A
Answer from Weather Vane on Stack Overflow
🌐
Code Beautify
codebeautify.org β€Ί string-hex-converter
Best String to Hex Converter Online to Convert Text to Hex.
This tool saves your time and helps to convert plain text to Hex number system with ease. This tool allows loading the Text data URL, which loads String and converts to Hex.
Discussions

How to convert string to hex value in C - Stack Overflow
Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... Save this question. Show activity on this post. I have string "6A" how can I convert into hex value 6A? More on stackoverflow.com
🌐 stackoverflow.com
String to HEX
I've tried .encode, binascii.hexlify, and a few other things. Ok, well, encode was the correct one, so do that. More on reddit.com
🌐 r/learnpython
7
5
September 2, 2024
How to convert string to hex in Python? - Stack Overflow
I using the pyqt5 line edit box as my input boxes. I want to take the input from the input boxes and convert it from string to hex to send to serial capture. For example I did this but I didn't suc... More on stackoverflow.com
🌐 stackoverflow.com
python - How to convert a hex string to hex number - Stack Overflow
I want to convert a hex string (ex: 0xAD4) to hex number, then to add 0x200 to that number and again want to print that number in form of 0x as a string. i tried for the first step: str(int(str(i... More on stackoverflow.com
🌐 stackoverflow.com
🌐
RapidTables
rapidtables.com β€Ί convert β€Ί number β€Ί ascii-to-hex.html
String to Hex | ASCII to Hex Code Converter
Convert decimal to hex byte Β· Continue with next character Β· Paste text in input text box. Select character encoding type. Select output delimiter string. Press the Convert button. Get letter Β· Get ASCII code of the letter from ASCII table Β· Convert decimal to hex byte Β·
🌐
Onecompiler
tools.onecompiler.com β€Ί string-to-hex
String to Hex converter online
Enter or paste the string in the Enter String text area. Click on Convert button to see the result in the Converted Hex text area.
🌐
Hex to String
hextostring.com
Hex to String Converter Online
If you convert hex extracted from image file headers or other non-text files, you will only get messy control characters and symbols that cannot be used normally. Hex code is mainly used to represent text data. Yes, we provide a dedicated String to Hex Converter.
🌐
DenCode
dencode.com β€Ί en β€Ί string β€Ί hex
Hexadecimal to String Converter Online - DenCode
Hex string is the binary value of the string in hexadecimal notation. Since the binary value differs depending on the character encoding, the conversion result to a hex string also differs.
Find elsewhere
🌐
HexHero
hexhero.com β€Ί converters β€Ί string-to-hex
String to Hex Converter
Convert strings to hexadecimal format instantly. Free online string to hex converter with UTF-8 support. No ads, no signup. Perfect for developers and programmers.
🌐
Hex to String
hextostring.com β€Ί string-to-hex
String to Hex Converter Online
A String to Hexadecimal Converter is a unique digital utility that translates human-readable text (a string) into its hexadecimal (hex) representation. Hexadecimal is a base-16 number system that uses sixteen separate symbols: 0-9 represent values zero through nine, and A-F (or a-f) represent values 10 through fifteen.
🌐
Code Beautify
codebeautify.org β€Ί hex-string-converter
Hex to String Converter Online to Convert Hex to Text
Upside Down Text Letter Randomizer NTLM Hash Generator Password Generator Random Words Generator Text Minifier Word Repeater String Builder Intelligent Message Filter Word Replacer Reverse String Text Reverser HTML Encode HTML Decode Base32 Encode Base32 Decode Base58 Encode Base58 Decode Base64 Encode Base64 Decode URL Encode URL Decode String to Hex Converter Hex to String Converter String to Binary Converter Binary to String Converter Case Converter Delimited Text Extractor Remove Punctuation Remove Accents Remove Duplicate Lines Remove Empty Lines Remove Line Breaks Remove Extra Spaces Remove Whitespace Remove Lines Containing Sort Text Lines Text to ROT13 ROT13 to Text Calculate String Length Text Flipper Text Replacer
🌐
Convert String
convertstring.com β€Ί EncodeDecode β€Ί HexEncode
Hex Encode - Online Hex Encoder
Convert text to hex and hex encode strings. Online tool for hex encoding a string. Convert text into a hexadecimaly encoded string using this free online text to hex encoding utility.
🌐
CleanCSS
cleancss.com β€Ί string-to-hex
String To Hex Converter
Enter a string number or string to get the hex version. Base number and string converter.
🌐
Omni Calculator
omnicalculator.com β€Ί other β€Ί text-to-hex
Text-to-Hexadecimal Converter
March 25, 2026 - The hexadecimal-to-text converter lets you convert strings to hex values using different encodings.
🌐
Browserling
browserling.com β€Ί tools β€Ί text-to-hex
Text to Hex Converter - Transform Text to Hex String - Online - Browserling Web Developer Tools
World's simplest online text to hexadecimal converter for web developers and programmers. Just paste your text in the form below, press the Convert button, and you'll get text in hex format. Press a button – get hex text. No ads, nonsense, or garbage.
🌐
Teleport
goteleport.com β€Ί home β€Ί resources β€Ί tools β€Ί text to hex converter | instantly convert text to hexadecimal
Text to Hex Converter | Instantly Convert Text to Hexadecimal | Teleport
Text to hex conversion transforms text characters into their corresponding hexadecimal values using encoding systems like ASCII or Unicode. Essentially, it's a way to represent text data in a base-16 numbering system, where each character maps ...
🌐
Online Tools
emn178.github.io β€Ί online-tools β€Ί hex_encode.html
Encode String to Hex (Base16) - Online Tools
Encode text or binary data as Hex (Base16) online using UTF-8, UTF-16, Base64, and other input encodings.