ThisCalculator

Everyday

Hex Epoch Time Converter: How to Decode Timestamps

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

A hex epoch time converter takes a hexadecimal number and turns it into a human-readable date and time, or does the reverse. You enter either a hex string (like 5F1F2A3B) or a Unix timestamp, and the converter returns the corresponding UTC date/time and the original value in the other format.

Formula

The core formula is simple: a Unix epoch timestamp is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC (excluding leap seconds). To convert from hex to decimal, treat the hex string as a base-16 integer and convert it to base 10. The reverse conversion takes the decimal timestamp and expresses it in base 16.

  • hex – the hexadecimal input string (e.g., 5F1F2A3B)
  • dec – the decimal Unix timestamp (e.g., 1599999995)
  • UTC – the date and time in Coordinated Universal Time, derived from the decimal timestamp using standard date arithmetic

Worked Example

Using the default values from the calculator above, let’s convert 5F1F2A3B to a decimal timestamp and then to a date.

  1. Start with the hex string: 5F1F2A3B
  2. Convert each hex digit to decimal: 5 = 5, F = 15, 1 = 1, F = 15, 2 = 2, A = 10, 3 = 3, B = 11
  3. Compute the value: (5 × 16^7) + (15 × 16^6) + (1 × 16^5) + (15 × 16^4) + (2 × 16^3) + (10 × 16^2) + (3 × 16^1) + (11 × 16^0) = 1599999995
  4. Now convert 1599999995 seconds since 1970-01-01 to a date: divide by 86,400 (seconds per day) to get days, then convert to calendar date. The result is 2020-09-13 12:26:35 UTC.

The calculator’s output for these defaults is 1599999995 and 2020-09-13 12:26:35.

Why Hex Timestamps Appear

Hexadecimal timestamps are common in low-level programming, embedded systems, and debugging. Many systems store time as a 32-bit or 64-bit integer, and when you view raw memory dumps, packet captures, or firmware logs, those integers are often displayed in hex. For example, a network protocol might include a timestamp field in hex, and a developer needs to convert it to understand when an event occurred. Similarly, some databases and file formats (like certain binary formats) store timestamps as hex values to save space or align with hardware registers.

How to Read a Hex Timestamp

First, determine the size of the timestamp. A 32-bit timestamp fits in 8 hex digits (e.g., 5F1F2A3B), while a 64-bit timestamp uses up to 16 hex digits (e.g., 000000005F1F2A3B). The calculator above assumes a standard Unix timestamp (seconds since 1970). If your hex value represents milliseconds, microseconds, or a different epoch (like 1900 or 2000), you’ll need to adjust accordingly. For instance, a hex value of 1A2B3C4D might be milliseconds since 1970, which you’d divide by 1000 to get seconds before converting.

Common Mistakes When Converting

  • Ignoring sign: A 32-bit timestamp can be negative if it’s before 1970 (in signed representation). Hex values like FFFFFFFF represent -1 in signed 32-bit, which corresponds to 1969-12-31 23:59:59 UTC.
  • Mixing endianness: In binary data, the bytes might be stored little-endian (least significant byte first) or big-endian. A hex string like 2A3B5F1F could be the same timestamp as 5F1F2A3B if the byte order is reversed. Always check the byte order of your source.
  • Using the wrong epoch: Unix time starts at 1970, but some systems use 1900 (like NTP) or 2000 (like some embedded systems). A hex value that seems off by decades might just be using a different epoch.
  • Forgetting fractional seconds: Some timestamps include a fraction (e.g., 0.123 seconds) stored as a separate field or as a fixed-point number. The converter above only handles whole seconds.

Hex vs. Decimal vs. Other Bases

While decimal is what humans use daily, hex is convenient for computers because each hex digit represents exactly 4 bits. This makes it easy to see the binary structure of a timestamp. For example, the hex value 5F1F2A3B in binary is 01011111000111110010101000111011. If you’re debugging a bitfield where the top bit is a flag, hex makes that visible. Other bases like octal are rare, but you might encounter them in permission settings (Unix chmod) or old Unix utilities. The converter above focuses on hex because it’s the most common alternative to decimal in technical contexts.

Practical Use Cases

  • Debugging logs: When a system prints a timestamp in hex (e.g., in a kernel panic dump), you can convert it to know exactly when the crash happened.
  • Network analysis: Some protocols (like NTP) use hex timestamps in packet headers. Converting them helps correlate events across systems.
  • Reverse engineering: When analyzing a binary file, you might find a hex timestamp that tells you when the file was created or modified.
  • Database queries: Some databases store timestamps as hex strings (e.g., in MongoDB’s ObjectId, the first 4 bytes are a Unix timestamp). Converting that hex to a date helps you understand when a record was inserted.

Limitations of the Calculator

This converter works for whole-second Unix timestamps in the range that JavaScript can handle precisely (up to about 9 quadrillion, which covers all realistic 64-bit timestamps). It does not handle leap seconds (Unix time ignores them), nor does it account for time zones other than UTC. For local time conversion, you’ll need to apply your timezone offset separately. Also, if your hex value is larger than 16 digits, it may exceed JavaScript’s safe integer range, and the result might be approximate. For most practical purposes—32-bit and 64-bit timestamps—the calculator is accurate.

Frequently Asked Questions

How do I convert a hex timestamp to a normal date?

Enter the hex value into the converter above, and it will give you the decimal epoch and the UTC date/time. If you need a specific timezone, add or subtract your offset from UTC (e.g., for Eastern Standard Time, subtract 5 hours).

What does 0x5F1F2A3B mean?

It’s a hexadecimal representation of the decimal number 1599999995. As a Unix timestamp, that corresponds to September 13, 2020, at 12:26:35 UTC. The “0x” prefix is just a common way to denote hex in programming; the converter above doesn’t require it, but you can include it.

Why do some timestamps start with 0x00000000?

That’s often because the timestamp is stored in a 64-bit field, and the upper 32 bits are zero for dates before 2106. For example, 0x000000005F1F2A3B is the same as 0x5F1F2A3B but padded to 64 bits. The converter handles this fine—just paste the whole value.

Can I convert a hex timestamp that includes milliseconds?

Yes, but you need to adjust the result. If your hex value represents milliseconds since the epoch, first convert it to decimal, then divide by 1000 to get seconds, and then convert to a date. The calculator above assumes seconds, so you’ll need to do that division manually or use a different tool.

What is the hex value for the current time?

Take the current Unix timestamp (seconds since 1970), convert it to hexadecimal. For example, if the timestamp is 1700000000, the hex is 6553A100. You can use the reverse conversion in the calculator: enter the decimal timestamp and it will show the hex.

Is a hex timestamp always in UTC?

Unix timestamps are defined as UTC, but the system that generated the hex value might have used a different epoch or timezone. If you’re unsure, check the documentation of the system. The converter assumes the standard Unix epoch (1970-01-01 UTC) and returns UTC time.

Related

Formula used
in hex | Hex timestamp | - | 5F1F2A3B | 0
in dec | Decimal timestamp | - | 1599999995 | 0
out dec | Decimal epoch | - | hex | 0
out utc | UTC date/time | - | dec | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.