Skip to content
A simple module for Hex encoding / decoding in Elixir.
CSS Elixir JavaScript
Find file
Latest commit 8a20cfa @rjsamson Update docs with version


A simple module for hexadecimal encoding / decoding in Elixir.

Note: name change from hex to hexate

Now that Elixir includes integration with, the library has been renamed hexate to avoid namespace clashes.

This was manifesting itself with intermittent failures when running test suites. If you experience this, update your deps!

If you really must use the old version, it's on the branch pre-rename-to-hexate.

Adding to your mix.exs

defp deps do
    {:hexate,  ">= 0.5.0"}


Encode to binary string:

iex> Hexate.encode("This is a test.")

iex> Hexate.encode('This is a test.')

iex> Hexate.encode(123456)

iex> Hexate.encode(15, 4)

iex> Hexate.encode(15.0, 2)

iex> Hexate.encode(15.0)

Decode to binary string:

iex> Hexate.decode("54686973206973206120746573742e")
     "This is a test."

iex> Hexate.decode('54686973206973206120746573742e')
     "This is a test."

Encode to list:

iex> Hexate.encode_to_list('This is a test.')

iex> Hexate.encode_to_list("This is a test.")

iex> Hexate.encode_to_list(123456)

Decode to list:

iex> Hexate.decode_to_list('54686973206973206120746573742e')
     'This is a test.'

iex> Hexate.decode_to_list("54686973206973206120746573742e")
     'This is a test.'

Convert hexate to integer:

iex> Hexate.to_integer('54686973206973206120746573742e')

iex> Hexate.to_integer("54686973206973206120746573742e")


  • Fork this repo
  • Make a feature branch
  • Issue a pull request


Robert J Samson David Parry

Something went wrong with that request. Please try again.