Hex8 to RGBA converter
Read a transparent hex color channel by channel: #33669980 splits into red 51, green 102, blue 153 and alpha 128, which is 0.501961 on a 0 to 1 opacity scale. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Hex
- #33669980
- Red
- 51
- Green
- 102
- Blue
- 153
- Alpha
- 128
The Hex8 to RGBA converter reads an eight-digit hexadecimal color in RRGGBBAA order and separates it into red, green, blue, and alpha channels. It validates the exact length and every character before any conversion takes place, so malformed input cannot produce plausible but incorrect numbers. The result includes four byte values from 0 through 255, a normalized alpha value from 0 through 1, and a canonical lowercase color code. It works with or without the leading hash and always applies the same transparent, deterministic rules.
Understand the RRGGBBAA byte order
An eight-digit hexadecimal color contains four consecutive byte pairs. The first pair is red, the second is green, the third is blue, and the final pair is alpha. For example, in #33669980, the pairs are 33, 66, 99, and 80.
Each pair represents one integer from 0 through 255 because two hexadecimal digits can encode exactly one byte. Alpha follows the CSS RRGGBBAA convention: 00 means fully transparent and FF means fully opaque. This ordering matters because some other systems place alpha first and use AARRGGBB.
This converter deliberately does not guess or rearrange an alpha-first value. Supply RRGGBBAA, optionally preceded by one hash character, and the returned red, green, blue, and alpha fields preserve that order. The output also contains an rgba array using the same four byte values.
Validate first, then convert
Color strings can fail in ways that are easy to overlook. A missing digit shifts every later channel, an extra digit changes the intended grouping, and a character such as G is not part of hexadecimal notation. The converter therefore performs checks in a fixed sequence.
It first requires the hex field to be a string and removes surrounding whitespace. It removes one optional leading hash, then verifies that exactly eight characters remain. Only after the length is correct does it verify that all eight characters belong to 0–9, A–F, or a–f.
Conversion begins only when both checks pass. This prevents partial parsing behavior in which a generic number parser might accept a valid prefix and silently ignore invalid trailing text. It also gives stable error categories: wrong-size values report a length problem, while correctly sized values containing forbidden symbols report a character problem.
Valid input is normalized to lowercase with a leading hash, making equivalent uppercase and lowercase forms produce the same canonical color and identical channel values.
Use deterministic RGBA values in a workflow
The returned channels are suitable for validation pipelines, design-token transformations, stylesheet tooling, and data imports that need explicit numeric values. Keep in mind that the alpha byte is returned both as its exact integer and as a rounded normalized value. The canonical hex field is useful for deduplication because #AABBCCFF and aabbccff resolve to the same lowercase representation.
Invalid strings stop with an input error instead of being corrected or padded.
What you can do with it
Transform design tokens
Turn RRGGBBAA token values into explicit channel fields for a theme compiler or component system.
Validate imported colors
Reject malformed eight-digit colors before they enter a database, stylesheet, or graphics pipeline.
Inspect transparency
Read the exact alpha byte and its normalized opacity without estimating transparency by sight.
FAQ
Does the input require a leading hash?
No. Both #RRGGBBAA and RRGGBBAA are accepted, and the returned canonical hex value includes the hash.
Is alpha placed first or last?
Alpha is last. The required order is red, green, blue, alpha: RRGGBBAA, not AARRGGBB.
Are three-digit, six-digit, or four-digit colors accepted?
No. This capability requires exactly eight hexadecimal digits after the optional leading hash.
Are uppercase hexadecimal letters accepted?
Yes. Uppercase and lowercase A–F are accepted, and the canonical returned hex value is lowercase.
What does one conversion cost?
The price placeholder is resolved from the capability declaration.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/color/hex8-rgba \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"hex":"#33669980"}'const res = await fetch("https://api.kit.forhosting.com/color/hex8-rgba", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"hex": "#33669980"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/color/hex8-rgba",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"hex": "#33669980"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/color/hex8-rgba", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"hex":"#33669980"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"hex":"#33669980"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/color/hex8-rgba", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"hex": "#33669980"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "color.hex8_rgba",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Understand the RRGGBBAA byte order
A separate alpha_normalized field divides the alpha byte by 255 and rounds it deterministically to six decimal places, which is convenient for systems that represent opacity on a zero-to-one scale.
Use deterministic RGBA values in a workflow
Because the converter uses no network access, current time, locale settings, or random state, the same input always yields the same JSON output. Use the integer when preserving the original eight-bit representation matters; use alpha_normalized when an API expects opacity between zero and one. One conversion is billed at $0.002 through the API, while the deterministic browser path can support immediate interactive use without changing the parsing rules.
Technical questions
What range do the channels use?
Red, green, blue, and alpha are integers from 0 through 255. alpha_normalized ranges from 0 through 1.