iOS / Android Dev Tools

APNs token formatter

Choose the input notation, then format the same bytes as hex or a decimal array.

APNs token formatter

Token input

Hex: optional <…> and ASCII whitespace. Decimal: unsigned 0–255 values.

Formatted result

Counts describe syntax only; they do not confirm a usable APNs token.

Processed in your browser. Input is not sent or saved.

Options

Enter a complete byte sequence.

The APNs token formatter helps when a device log and a provider form show the same bytes differently. A leading zero belongs to the byte; deleting it can change the value or leave an incomplete pair.

Start with the complete data from your registration callback. A debug description is only a display and may omit bytes. Formatting cannot reconstruct anything that was left out.

Why use the APNs token formatter?

Keep zeros and byte order

The APNs token formatter removes declared whitespace and one outer pair of angle brackets. It never strips arbitrary letters from a log or pads an odd final digit. Each byte stays in its original position.

Spaced byte tiles inside brackets become a continuous row, with the same leading empty tile and order.

Compare representations without decoding text

A hexadecimal string and a decimal array can describe identical data. Switch the output to see byte boundaries; uppercase and lowercase change only the spelling of hex digits. No characters are decoded from the token.

Three differently grouped rows connect to the same ordered set of byte tiles.

Avoid guessing the input notation

01

Declare hex or decimal first

In hex mode, 10 means the byte with decimal value 16. In decimal mode, 10 means ten. The input selector resolves this ambiguity; the tool never guesses from the digits.

02

Pause automatic updates deliberately

Automatic formatting waits 350ms after edits. Turn it off to review changes, then run with Ctrl/Cmd + Enter. Changing input or options immediately disables export of the previous result.

03

Check a byte view before exporting

Use spaced hex to inspect leading 00 bytes, or a decimal array to compare an unsigned byte dump. The count describes the parsed data, not whether APNs will accept it. Example and clear actions have a preview and one undo.

Three views of one byte sequence

Device token to hex, without integer conversion

Every byte produces two hex digits, including values below 16. A sequence such as 00 01 ff becomes 0001ff, never 1ff. Letter case does not affect the bytes.

Separate decimal grammar

Unsigned decimal values must be between 0 and 255. Use comma-separated values with optional outer square brackets, or whitespace-separated values without commas. Mixed separators such as 1 2,3 are rejected.

Diagnostics on the original input

Invalid hex, unmatched wrappers, odd digit counts and out-of-range bytes produce a line and column. The original text stays intact, so the reported position remains useful while correcting a copied log.

What formatting cannot establish

Length is information
APNs token format does not imply a fixed length. This tool accepts any nonempty sequence that fits its input budget; it does not require 32 bytes or 64 hex characters.
Only explicit cleanup
Hex allows ASCII whitespace and one complete outer <…> pair. Prefixes such as 0x, quotes, colons, commas and ellipses are errors. No missing byte is repaired and no non-hex character is silently discarded.
A device token is an opaque value
This is not a JWT, FCM token, Base64 or broadcast channel ID converter. It cannot extract a device identity, environment or readable message from the bytes.
No delivery verdict
A successful conversion checks local syntax only. Registration, topic, sandbox or production environment and provider authentication must be checked separately. There is no push request or credential input.
One bounded text input
The input budget is 65,536 UTF-16 code units, checked before parsing without truncation. No file import, URL import, multi-token batch or persistent history is provided. Decimal values reject negatives, leading zeros, fractions and exponents.

APNs token formatter questions

How do I convert an NSData device token to a string?

Read the actual bytes and encode each as two hexadecimal digits. On this page, paste complete hex data or unsigned decimal values in the matching mode. Do not use a truncated NSData description as the data source.

How long is an iPhone device token?

Apple states that device tokens have variable length. A familiar byte count is not a guarantee. This page reports the count of the supplied bytes without declaring a token valid or invalid based on length.

Can I validate an APNs or GCM device token?

Not from its appearance alone. This page checks only the declared byte notation for an APNs device token. It does not validate registration or interpret GCM and FCM tokens.

What token format should I use after BadDeviceToken?

A device-token request uses a hexadecimal byte string. Check that you copied the complete value and selected the correct environment and topic in your sender. Removing spaces cannot fix every cause of BadDeviceToken.

Why did the displayed device-token format change?

Debug descriptions are presentation, not a stable serialization contract. Obtain bytes from the registration callback and explicitly encode them. If a description contains an ellipsis or a length summary, the missing data cannot be recovered here.

Found an encoding or parsing issue?

Prepare the next token

Use the APNs token formatter to inspect the exact bytes you have, select the representation your next step expects, and copy the current result.