ForHosting KIT · Images

Hex alpha to opacity percent

Find the opacity hidden in a hex color: the last pair of #33669980 is 80, which is byte 128 and an opacity of 50.2%, not the 50% many people assume. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Hex
#33669980
You get
Alpha hex
80
Alpha byte
128
Opacity percent
50.2

This hex alpha to opacity converter reads the final two digits of an eight-digit RRGGBBAA color and turns that byte into a percentage from 0% through 100%. It validates the complete color before calculating anything, accepts an optional leading hash, and reports the normalized color, alpha pair, decimal byte, and opacity percentage. The result is deterministic and consistently rounded to two decimal places, making it suitable for design tokens, CSS reviews, automated migrations, documentation, and tests that need a stable numeric answer rather than a visual estimate.

Read the alpha byte in the correct position

An eight-digit hexadecimal color in CSS order contains four byte pairs: red, green, blue, and alpha. The alpha byte is therefore always the final pair in RRGGBBAA. For example, the pairs in #33669980 are 33, 66, 99, and 80, so 80 is the value this converter uses.

That ordering matters because some graphics tools and older platform formats use AARRGGBB, where alpha appears first. This capability does not guess between conventions or rearrange channels. It deliberately accepts RRGGBBAA only, with or without one leading hash character.

Every one of the eight digits is checked even though only the last two drive the percentage. Validating the entire value prevents a malformed color such as #ZZZZZZ80 from appearing trustworthy merely because its alpha pair happens to be valid. Use a format conversion first if your source stores alpha at the beginning.

Audit design tokens

Turn embedded alpha bytes into readable percentages while retaining the exact byte for traceability.

Review generated CSS

Confirm that an exported RRGGBBAA color carries the opacity expected by designers and developers.

Which eight-digit hex ordering is supported?

The required ordering is RRGGBBAA, with alpha in the final two digits. AARRGGBB is not accepted as a separate convention.

Can I include the leading hash?

Yes. Both #33669980 and 33669980 are valid and produce the same normalized result.

How is the percentage calculated?

The alpha pair is parsed as a byte, divided by 255, multiplied by 100, and rounded to two decimal places.

Why does alpha 80 produce 50.2 instead of 50?

Hex 80 is decimal 128, and 128 divided by 255 is slightly greater than one half. The two-decimal result is 50.2.

What opacity do the alpha pairs 00 and FF give?

00 gives 0%, a fully transparent color, and FF, which is byte 255, gives 100%, a fully opaque one. Every pair in between is divided by 255 and multiplied by 100.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/color/hex-alpha-to-opacity

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/color/hex-alpha-to-opacity \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"hex":"#33669980"}'
{
  "hex": "#33669980"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "color.hex_alpha_to_opacity",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the alpha byte in the correct position

The response includes a lowercase canonical hex value and preserves the extracted pair separately as alpha_hex, making it easy to verify exactly which byte produced the calculation.

Convert a byte to a stable percentage

A hexadecimal byte ranges from 00 through FF, equivalent to decimal values from 0 through 255. The conversion divides the decimal alpha byte by 255 and multiplies the result by 100. For example, an alpha byte of 80 is decimal 128, so it becomes 50.2 rather than an assumed 50. No percent sign is embedded in the numeric field, so the result can be compared, sorted, serialized, or passed directly into further calculations without stripping display text. Opacity uses the same endpoints: byte 0 is fully transparent and byte 255 is fully opaque. Because most intermediate byte values do not map to a terminating decimal percentage, the returned opacity_percent is rounded to two decimal places. This rule is fixed and deterministic: identical input always produces identical JSON, independent of browser locale, current time, network state, or machine settings. The exact alpha_byte remains in the response alongside the rounded percentage, allowing callers to preserve the original eight-bit value when necessary. The special endpoints remain exact: 00 returns 0 and FF returns 100.

Validate inputs and use the result safely

Strict input handling is important when color values flow through design systems, code generators, or stylesheet migrations. The converter rejects missing values, non-string values, the wrong number of hexadecimal digits, and characters outside 0-9 or A-F. Whitespace around a valid string is ignored, and letter case is accepted, but shorthand colors, six-digit RGB colors, multiple hash marks, and alpha-first values are not silently repaired. A rejected value becomes an invalid_input error with a useful message instead of returning a misleading percentage. That behavior lets automated pipelines stop early and show the actual source problem. One API conversion costs $0.002; the pure calculation has no network dependency and can also support immediate browser execution. Treat opacity_percent as the rounded presentation value and alpha_byte as the exact source value whenever a later step needs lossless round-trip behavior.

Build migration fixtures

Create stable numeric opacity values for tests that migrate eight-digit colors into another representation.

What happens when the color is invalid?

The request returns an invalid_input error describing the missing value, invalid length, type problem, or invalid character.

What does an API conversion cost?

One conversion costs $0.002.

Read the full KIT documentation →