ForHosting KIT · Developer Utilities

Binary decoder outputs calculator

A binary decoder turns an n-bit input code into one active selection among many output lines.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

This calculator applies the fundamental relationship m = 2^n, then maps those unique selections onto an inclusive system address range. Enter the number of input or address lines and, if needed, the first address assigned to the device. The result gives the decoder notation, output count, number of unique addresses, and both decimal and hexadecimal range endpoints, making it useful for logic exercises and practical memory or peripheral address planning.

From input lines to decoder outputs

An n-line binary input can represent 2^n distinct bit patterns because every line independently has two states. A decoder assigns one output to each pattern, so an ideal full decoder requires m = 2^n outputs. For example, three input lines represent 000 through 111 and therefore drive eight mutually selectable outputs; this is called a 3-to-8 decoder. Four lines create sixteen patterns and a 4-to-16 decoder. Enter the number of input lines, address lines, or select lines as input_lines. The calculator returns output_lines and unique_addresses with the same value, as well as conventional decoder notation. This calculation assumes a full binary decoder rather than a partial device that deliberately omits combinations. Enable pins do not normally increase the number of decoded combinations: they control whether the device participates, while the n select inputs determine which one of the 2^n outputs is chosen. Cascaded decoders can still be analyzed by counting the effective independent select bits presented to the complete arrangement.

Reading the uniquely selected address range

In an address-decoding system, every decoder output can select one register, memory location, peripheral, or subordinate block. Therefore an n-input decoder can uniquely select 2^n consecutive addresses when its output positions correspond to the low-order address combinations. The optional base_address identifies the first location assigned to that block. The last location is base_address + 2^n - 1 because both endpoints are included. A four-line decoder based at decimal 4096, for example, covers sixteen addresses: 4096 through 4111, or 0x1000 through 0x100F. The response deliberately labels the range as inclusive and shows decimal and hexadecimal endpoints to reduce off-by-one mistakes. A count of sixteen does not end at base plus sixteen; it ends at base plus fifteen. If no base is supplied, zero is used, giving the canonical range 0 through 2^n - 1. The calculation describes the range capacity; actual hardware must also decode any higher-order address bits needed to establish the chosen base and prevent mirrored addresses.

Applying the result to real hardware

Use the output count when selecting a decoder IC, drawing truth tables, or deciding how many chip-select signals a set of address lines can provide. Use the address range when documenting a memory map or checking whether adjacent allocations overlap. The base address should match the system's placement of the decoded block, and alignment to the block size is often convenient because it makes the high-order bits constant throughout the range. However, this calculator permits any nonnegative base so it can also model exercises and unusual mappings. It accepts between one and fifty-two input lines and keeps every result within JavaScript's exact integer range. A request is rejected if the ending address would exceed that range, preventing a plausible-looking rounded endpoint. Remember that the mathematical decoder result does not describe electrical polarity, propagation delay, fan-out, enable behavior, or whether outputs are active-high or active-low. Those properties come from the selected component's data sheet. It also does not reserve space in a real system; it provides exact values for design and review. Automated API use is charged at $0.002 per request.

Choose a decoder size

Convert the available select-line count into the exact number of one-hot outputs required for a logic design.

Lay out a peripheral map

Calculate inclusive decimal and hexadecimal endpoints for a peripheral block placed at a specified base address.

Check digital-logic coursework

Verify n-to-m decoder notation, output count, and the corresponding range without an off-by-one error.

How many outputs does an n-line decoder have?

A full binary decoder has 2^n outputs, one for every possible n-bit input combination.

Why is the ending address base plus 2^n minus one?

The range is inclusive. Its first address already consumes one of the 2^n positions, so the final offset is 2^n - 1.

Do enable inputs count as decoder input lines?

No. Use the independent binary select or address inputs for n. Enable pins control whether decoding is active but do not add ordinary output selections.

Can I enter a hexadecimal base address?

The input contract accepts a nonnegative decimal integer. The response provides both decimal and hexadecimal forms of each endpoint.

What does an API request cost?

Each API request costs $0.002. The calculation is deterministic and also suitable for the free browser runner.

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/elec/decoder-outputs

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/elec/decoder-outputs \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input_lines":4}'
{
  "input_lines": 4
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "elec.decoder_outputs",
  "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 full KIT documentation →