MIME B encoded-word
Hello café becomes =?UTF-8?B?SGVsbG8gY2Fmw6k=?=, an RFC 2047 encoded-word that carries the accent safely through mail headers such as Subject or From. Decoding turns such tokens back into readable text. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Text
- Hello café
- Calculation mode
- Encode
- Result
- =?UTF-8?B?SGVsbG8gY2Fmw6k=?=
- Encoding
- mime-b
- Charset
- UTF-8
- Encoded word count
- 1
This MIME B encoded-word converter wraps plain UTF-8 text into RFC 2047 encoded-words of the form equals-question-mark charset question-mark B question-mark Base64 question-mark-equals, and unwraps those tokens back to readable text. Mail clients, SMTP pipelines, and legacy gateways still rely on B-encoding when a Subject, From display name, or other header must carry non-ASCII characters without breaking 7-bit transport rules. Pick encode to turn a phrase such as Hello café into a single UTF-8 B token, or pick decode to recover the original string from a header fragment you already hold. The engine is fully deterministic: the same text, mode, and charset always produce the same result, with no network calls, no random salts, and no date-dependent shortcuts.
Where MIME B encoded-words fit in email headers, debugging, and tests
Frontend and support teams decode header snippets during ticket investigation without pasting data into ad-hoc scripts that mishandle multi-word splits or forget the trailing question-mark-equals. Backend services encode configuration samples or short multilingual strings before putting them into MIME headers where 8-bit clean transport is not guaranteed. Quality engineers generate deterministic encode and decode pairs for contract tests so a mail library that claims RFC 2047 support cannot silently change Base64 padding rules or drop whitespace between adjacent encoded-words.
Educators use the same tool when teaching the difference between body transfer encodings such as quoted-printable and header-specific encoded-words that carry an explicit charset tag. Pair it with quoted-printable and plain Base64 helpers when you are building a small lab of free, deterministic MIME and text encoders for email and interoperability work.
What you can do with it
Email subject debugging
Encode or decode RFC 2047 B tokens from raw Subject or From headers so accents and multi-word splits match what mail clients display.
International header prep
Turn UTF-8 display names and subject phrases into transport-safe MIME B encoded-words before sending through restricted gateways.
FAQ
What does the MIME B encoded-word tool cost?
It is free in your browser on this page.
How is MIME B different from plain Base64?
MIME B adds the RFC 2047 wrapper =? charset? B?...? = so mail headers carry both the charset and the Base64 text in one token.
What happens if the encoded-word syntax is malformed?
Incomplete tokens, Q-encoding, invalid Base64, empty charset, or junk outside tokens are rejected rather than guessed.
Is the result deterministic?
Yes. The same text, mode, and charset always produce the same result with no network, randomness, or date-dependent behavior.
Why is a long subject split into several encoded-words?
Because each encoded-word is limited to seventy-five characters, so longer text is cut into several tokens separated by spaces. When decoding, adjacent tokens join back into one continuous string, so the reader sees a single subject line.
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/enc/mime-b-encoding \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Hello café"}'const res = await fetch("https://api.kit.forhosting.com/enc/mime-b-encoding", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "Hello café"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/enc/mime-b-encoding",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "Hello café"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/enc/mime-b-encoding", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"Hello café"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"Hello café"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/enc/mime-b-encoding", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "Hello café"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "enc.mime_b_encoding",
"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
Malformed tokens—missing terminators, Q-encoding mixed into a B-only request, or invalid Base64—fail with invalid_input instead of guessing. Use it free in the browser for mail debugging and MIME practice, or call the API at $0.002 per successful request when CI and backend services need reproducible encoded-word transforms.
What a MIME B encoded-word is and what this tool returns
RFC 2047 defines the encoded-word syntax so unstructured header fields can carry international text without violating older mail restrictions. A B-encoded word starts with equals-question-mark, names a charset, uses the letter B to mark Base64 content transfer, carries the Base64 of the charset-encoded octets, and ends with question-mark-equals. Adjacent encoded-words may be separated by linear whitespace so long phrases stay within the classic seventy-five character limit per token while still decoding to a single continuous string. This page always follows that B-only contract for UTF-8 text: encode mode converts your string with a UTF-8 encoder, Base64-encodes the bytes with standard padding, wraps them as equals-question-mark UTF-8 question-mark B question-mark payload question-mark-equals, and splits into multiple tokens when a single word would exceed seventy-five characters. Decode mode requires the input to consist of one or more complete B tokens separated only by spaces or newlines; it rejects Q-encoding tokens, incomplete equals-question-mark fragments, non-whitespace junk outside tokens, and invalid Base64 inside the payload. The JSON response includes result for the transformed string, mode echoing encode or decode, encoding fixed to mime-b, charset reporting UTF-8, encoded_word_count for how many tokens were produced or consumed, and input_bytes plus output_bytes so tests can assert sizes. There is no silent repair path: either the string is valid MIME B syntax for this tool or the request fails with invalid_input. If you need body content-transfer encoding instead of header tokens, prefer quoted-printable or plain Base64 endpoints; this landing is specifically for charset-tagged B encoded-words used in email headers.
How text, mode, and charset are read and how results stay reproducible
Encode accepts any Unicode string, converts it with the platform TextEncoder to UTF-8 bytes, emits standard Base64 with padding, and builds one or more encoded-words that never exceed seventy-five characters. After bytes are recovered, a fatal UTF-8 decode ensures binary garbage does not become mojibake text. The preferred payload field is text, with aliases input, value, and s so forms, query strings, and SDK clients can reuse the same contract without renaming columns. Mode defaults to encode and accepts decode explicitly; aliases op, direction, and action map to the same switch for scripts that already use those names. Charset is optional on encode, defaults to UTF-8, and only UTF-8 is accepted for the byte payload—aliases such as utf8 normalize to the canonical UTF-8 tag written into the token. Decode requires well-formed B tokens: a truncated equals-question-mark UTF-8 question-mark B question-mark SGVsbG8 without the final question-mark-equals, a Q-encoded token, empty charset, or Base64 garbage all fail with a clear invalid_input message naming the malformed encoded-word syntax. Pair the free browser run on this page with the priced API when you need the identical mathematical result inside an automated pipeline without re-implementing RFC 2047 tables yourself. Invalid inputs return invalid_input and are not charged, which keeps validation cheap while successful transforms remain a fixed item price of $0.002.
Where MIME B encoded-words fit in email headers, debugging, and tests
Developers meet B-encoding when they inspect Subject lines marked with equals-question-mark UTF-8 question-mark B question-mark payloads, craft international display names for From or To headers, or debug why a café accent became an opaque Base64 token in a raw message dump. On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split—free interactive exploration and a priced, identical API—matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the encoded result.
Integration use cases
MIME fixture generation
Produce reproducible =?UTF-8?B?...?= strings for unit tests, golden files, and SMTP or IMAP integration checks.
Technical questions
What modes are supported?
mode=encode (default) turns plain text into MIME B encoded-words. mode=decode turns valid B tokens back into UTF-8 text.