Questions tagged [hex]

Hexadecimal (also base 16, or hex) is the base-16 positional numeral system, using the 16 symbols 0–9 and A‒F.

Hexadecimal (also base 16, or hex) is a numeral system with a base of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F (or alternatively a–f) to represent values ten to fifteen.

Each hexadecimal digit represents four binary digits (bits), and the primary use of hexadecimal notation is a human-friendly representation of binary-coded values in computing and digital electronics. More information may be found here.

Other numeral systems:

9640 questions
1892
votes
30 answers

How to convert decimal to hexadecimal in JavaScript

How do you convert decimal values to their hexadecimal equivalent in JavaScript?
Luke Smith
  • 23,504
  • 8
  • 29
  • 28
1619
votes
53 answers

How do you convert a byte array to a hexadecimal string, and vice versa?

How can you convert a byte array to a hexadecimal string and vice versa?
alextansc
  • 4,626
  • 6
  • 29
  • 45
1441
votes
8 answers

Hex transparency in colors

I'm working on implementing a widget transparency option for my app widget although I'm having some trouble getting the hex color values right. Being completely new to hex color transparency I searched around a bit although I couldn't find a…
SweSnow
  • 17,504
  • 10
  • 36
  • 49
964
votes
10 answers

Convert hex string to integer in Python

How do I convert a hex string to an integer? "0xffff" ⟶ 65535 "ffff" ⟶ 65535
Matt
  • 84,419
  • 25
  • 57
  • 67
812
votes
34 answers

Java: convert a byte array to a hex string?

I have a byte array filled with hex numbers and printing it the easy way is pretty pointless because there are many unprintable elements. What I need is the exact hexcode in the form of: 3a5f771c
Andre
  • 9,000
  • 5
  • 26
  • 32
801
votes
61 answers

RGB to hex and hex to RGB

How to convert colors in RGB format to hex format and vice versa? For example, convert '#0080C0' to (0, 128, 192).
Sindar
  • 10,389
  • 6
  • 32
  • 44
698
votes
20 answers

How do I get the color from a hexadecimal color code using .NET?

How can I get a color from a hexadecimal color code (e.g. #FFDFD991)? I am reading a file and am getting a hexadecimal color code. I need to create the corresponding System.Windows.Media.Color instance for the hexadecimal color code. Is there an…
viky
  • 17,275
  • 13
  • 71
  • 90
686
votes
22 answers

Programmatically Lighten or Darken a hex color (or rgb, and blend colors)

Here is a function I was working on to programmatically lighten or darken a hex color by a specific amount. Just pass in a string like "3F6D2A" for the color (col) and a base10 integer (amt) for the amount to lighten or darken. To darken, pass in a…
Pimp Trizkit
  • 19,142
  • 5
  • 25
  • 39
608
votes
34 answers

How do I use hexadecimal color strings in Flutter?

How do I convert a hexadecimal color string like #b74093 to a Color in Flutter? I want to use a HEX color code in Dart.
creativecreatorormaybenot
  • 114,516
  • 58
  • 291
  • 402
554
votes
12 answers

Convert integer to hexadecimal and back again

How can I convert the following? 2934 (integer) to B76 (hex) Let me explain what I am trying to do. I have User IDs in my database that are stored as integers. Rather than having users reference their IDs I want to let them use the hex value. The…
codette
  • 12,343
  • 9
  • 37
  • 38
543
votes
5 answers

Why are hexadecimal numbers prefixed with 0x?

Why are hexadecimal numbers prefixed as 0x? I understand the usage of the prefix but I don't understand the significance of why 0x was chosen.
unj2
  • 52,135
  • 87
  • 247
  • 375
442
votes
25 answers

Convert a string representation of a hex dump to a byte array using Java?

I am looking for a way to convert a long string (from a dump), that represents hex values into a byte array. I couldn't have phrased it better than the person that posted the same question here. But to keep it original, I'll phrase it my own way:…
rafraf
  • 4,806
  • 3
  • 19
  • 20
386
votes
4 answers

Need a good hex editor for Linux

I need a good hex editor for Linux, and by good I mean: Fast Has search/replace features Can display data not only in hex, but also binary, octal, etc. Can work with huge (> 1 GB) files without becoming slow and unresponsive (this requirement is…
user500944
376
votes
9 answers

What's the correct way to convert bytes to a hex string in Python 3?

What's the correct way to convert bytes to a hex string in Python 3? I see claims of a bytes.hex method, bytes.decode codecs, and have tried other possible functions of least astonishment without avail. I just want my bytes as hex!
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
375
votes
19 answers

byte[] to hex string

How do I convert a byte[] to a string? Every time I attempt it, I get System.Byte[] instead of the value. Also, how do I get the value in Hex instead of a decimal?
user34537
1
2 3
99 100