RAX2(1)

πŸ’… RAX2(1) β€” Radare2 Base Converter

okay so bestie, gather round, because rax2 is genuinely one of the most underrated glow-ups in the radare2 family and I need you to know about it. It's the Radare2 Base Converter, and it's about to become your main character tool. πŸŽ€


✨ SYNOPSIS ✨

rax2 [-abcCdDeEfFhHijkKnoqrsStuUvwxXzZ] [[expr] ...]

🌸 DESCRIPTION 🌸

rax2 is a versatile calculator for numerical base conversions, string encoding/decoding, and data representation within Radare2 β€” and yes she does all of it. She supports C-string encoding, hexpairs, Base64, and a whole bunch of other formats. it's giving swiss army knife, no cap. πŸ”₯

the most common numerical bases, since we're being educated today:

  • binary (base 2) β€” for direct machine code interaction, iykyk
  • hexadecimal (base 16) β€” for memory addresses and compact data representation
  • decimal (base 10) β€” for human-readable calculations and interpretations, aka the one you can actually read at 3am

πŸ¦‹ OPTIONS πŸ¦‹

  • -a β€” Show ASCII table. the whole vibe check, laid out for you ✨
  • -b base β€” Force output mode (numeric base). your options are:
    • f β€” floating point
    • 2 β€” binary
    • 3 β€” ternary
    • 8 β€” octal
    • 10 β€” decimal
    • 16 β€” hexadecimal

and listen, when you use it with -s and -e, it selects the word size in bits for endian-swapping hex input. valid word sizes are 8, 16, 32, and 64 bits. don't try anything else, she will not be amused πŸ’€

  • -c β€” Show hexadecimal C string from integer value
  • -C β€” Dump stdin to C array in stdout. literally the xxd replacement, she ate
  • -d β€” Print the result in decimal (base 10)
  • -D β€” Decode the input data using base64
  • -e β€” Swap endianness. when paired with -s, it requires -b to specify the word size β€” no -b, no swap, that's the rule 🫢
  • -E β€” Encode the input data using base64
  • -f β€” Interpret the input number as a 32bit dword and display it using the IEEE 754 standard for floating point arithmetic. fancy fr fr
  • -F β€” Read C strings from stdin and output in hexpairs. super useful to load shellcodes πŸ‘‘
  • -h β€” Show usage help message
  • -H β€” Convert a string into a hash
  • -i β€” Convert LONG to/from IP ADDRESS
  • -j β€” Show the output in json format, the same as the r2 ?j 0x804 command
  • -k β€” Keep the same base as the input data. loyalty πŸ’–
  • -K β€” Show randomart key asciiart for values or hexpairs
  • -n β€” Append newline to the decoded output for human friendliness
  • -o β€” Convert from octal string to char (rax2 -o 162 62)
  • -q β€” Be quiet. Show less information or drop the superfluous details in the output. she's not mad, she's just quiet 🀫
  • -r β€” Show the same output as the r2's ? 0x804 command. and when combined with -S (-rS) it will print r2 commands to write the actual binary into radare2. iconic behavior
  • -s β€” Convert from hex pairs string to character (rax2 -s 43 4a 50)
  • -S β€” Convert from character to hex string (rax2 -S C J P)
  • -t β€” Convert epoch timestamp to human readable date format
  • -u β€” Convert given value to human readable units format
  • -v β€” Show version information
  • -w β€” Display the result as 16bit signed integer value
  • -x β€” Show hexpairs from integer value
  • -X β€” Convert a bit stream (an arbitrary sequence of 0 and 1 of any length) to hexadecimal. the result can be larger than 64bits, so don't come for her about size πŸ’…
  • -z β€” Convert from character string to binary (rax2 -z hello)
  • -Z β€” Convert from binary string to string (rax2 -Z 01000101)

🌈 USAGE 🌈

available variable types are, and I'm quoting this exactly because it's sacred:

  int       ->  hex           rax2 10
  hex       ->  int           rax2 0xa
  -int      ->  hex           rax2 -77
  -hex      ->  int           rax2 0xffffffb3
  int       ->  bin           rax2 b30
  int       ->  ternary       rax2 t42
  bin       ->  int           rax2 1010d
  ternary   ->  int           rax2 1010dt
  float     ->  hex           rax2 3.33f
  hex       ->  float         rax2 Fx40551ed8
  oct       ->  hex           rax2 35o
  hex       ->  oct           rax2 Ox12 (O is a letter)
  bin       ->  hex           rax2 1100011b
  hex       ->  bin           rax2 Bx63
  ternary   ->  hex           rax2 212t
  hex       ->  ternary       rax2 Tx23
  raw       ->  hex           rax2 -S < /binfile
  hex       ->  raw           rax2 -s 414141

πŸ”₯ EXAMPLES πŸ”₯

with no arguments, rax2 reads values from stdin. you can also pass one or more values as arguments, whatever fits your vibe:

$ rax2 33 0x41 0101b
0x21
65
0x5

you can do 'unpack' hexpair encoded strings easily. so easy. effortless. πŸ¦‹

$ rax2 -s 41 42 43
ABC

swap the byte order of each 32-bit word in a hex stream:

$ printf 1122334455667788 | rax2 -esb 32 | rax2 -S
4433221188776655

it supports some math operations, because of course she does:

$ rax2 1+1 "0x5*101b+5"
2
30

encode and decode binary file using base64:

$ rax2 -E < /bin/ls > ls.b64
$ rax2 -D < ls.b64 > ls

$ cmp /bin/ls ls && echo $?
0

use -z/-Z to convert between binary and string:

$ rax2 -z hello
01101000011001010110110001101100011011000000000000000000
$ rax2 -Z 01101000011001010110110001101100011011000000000000000000
hello

hash strings:

$ rax2 -H linux osx
linux: 0x5ccc1772
osx: 0x099bf94f

work with IP addresses:

$ rax2 -i 127.0.0.1
0x0100007f
$ rax2 -i 0x0100007f
127.0.0.1

it is a very useful tool for scripting, so you can read floating point values, or get the integer offset of a jump or a stack delta when analyzing programs. honestly? scripting queen. πŸ‘‘


🧚 ENVIRONMENT 🧚

rax2 does not use any environment variables. zero. none. she's low maintenance like that πŸ’œ


⭐ SEE ALSO ⭐


🌸 WWW 🌸

https://www.radare.org


πŸŽ€ AUTHORS πŸŽ€

pancake <pancake@nopcode.org>


okay bestie that's the whole page, go forth and convert everything. mwah πŸ’–

this edition dropped Aug 22, 2026 and lives in the RAX2(1) manual β€” see you in the next one, love u 🫢

πŸ“¦ where this page comes from