ASCII to EBCDIC Converter

Converts printable ASCII text (32-126) to its IBM EBCDIC code page 037 (CP037) hex byte values, the classic US/Canada mainframe character encoding, restricting input to printable characters rather than guessing at EBCDIC's own distinct control-code layout. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-27

Overview

Introduction

EBCDIC predates ASCII and is still very much alive on IBM mainframes today, and IBM code page 037 (CP037) is the common US/Canada variant most tools and references mean when they say "EBCDIC" without further qualification.

This tool converts printable ASCII text into its CP037 hex byte values, following the real, documented IBM code page table rather than an approximation.

What Is ASCII to EBCDIC Converter?

A text-to-hex encoder implementing the IBM EBCDIC code page 037 (CP037) table for printable ASCII characters 32 through 126.

It deliberately stops at the printable range: EBCDIC's control-code region has a different structure than ASCII's, and this tool would rather reject a control character outright than present an unverified guess as fact.

How ASCII to EBCDIC Converter Works

The input is validated as strict 7-bit ASCII, then each character is checked against a fixed 95-entry lookup table covering every printable ASCII character's documented CP037 byte value.

A character outside the printable 32-126 range (a control character) stops conversion with an error explaining that this converter is restricted to printable ASCII; otherwise each byte is formatted as 2-digit uppercase hex and joined with spaces.

When To Use ASCII to EBCDIC Converter

Use it when working with mainframe data interchange, COBOL copybooks, or any system that still communicates in EBCDIC and you need to see or produce CP037 byte values for known ASCII text.

It's also useful for learning or teaching how differently EBCDIC lays out letters, digits, and punctuation compared to ASCII's contiguous ranges.

Features

Advantages

  • Implements the real IBM CP037 table, verified against the Unicode Consortium's authoritative vendor mapping file, rather than an invented approximation.
  • Names the exact code page (CP037) rather than implying "EBCDIC" is a single universal table, since it isn't.
  • Explicit about the one thing it deliberately doesn't attempt: control-character mapping, rather than presenting a guess as settled fact.

Limitations

  • Only covers printable ASCII 32-126; control characters (0-31, 127) are rejected rather than mapped, since this tool isn't confident enough in a control-code EBCDIC mapping to present one.
  • Implements CP037 specifically; other EBCDIC code page variants (CP500, CP1047, etc.) assign some punctuation characters to different byte values.

Examples

Encoding uppercase letters

Input

ABC

Output

C1 C2 C3

EBCDIC's A-I letter group starts at C1, so A, B, and C map to consecutive bytes C1, C2, C3.

Encoding digits and space

Input

A 9

Output

C1 40 F9

Space is 0x40 in EBCDIC (not 0x20 like ASCII), and digits sit in the F0-F9 range, so '9' is 0xF9.

Rejecting a control character

Input

A	B

Output

Error: character "\t" at position 2 (code point 9) is a control character; this converter only supports printable ASCII (32-126).

Tab is a control character outside this tool's deliberately restricted printable-only scope.

Best Practices & Notes

Best Practices

  • If your target system uses a different EBCDIC code page (CP500, CP1047, etc.), verify the specific bytes you care about against that page's own table; CP037 and other pages disagree on some punctuation.
  • Round-trip through EBCDIC to ASCII Converter to confirm your output decodes back to exactly the text you started with.

Developer Notes

The table is a hand-transcribed array of 95 [character, hex] pairs covering ASCII 32-126, cross-checked against the Unicode Consortium's authoritative CP037.TXT vendor mapping file (unicode.org/Public/MAPPINGS/VENDORS/MICSFT/EBCDIC/CP037.TXT) rather than derived from a formula, since EBCDIC's letter/digit ranges have gaps that don't follow a simple arithmetic pattern. ebcdic-to-ascii-converter imports this exact array and inverts it, so both tools share one source of truth and a full 32-126 round trip is covered by this batch's test suite.

ASCII to EBCDIC Converter Use Cases

  • Producing CP037 byte values for test data feeding a mainframe integration or COBOL copybook
  • Reading EBCDIC-encoded data dumps by converting known ASCII reference text and comparing byte patterns
  • Teaching the historical, punch-card-derived structure of EBCDIC's letter and digit layout

Common Mistakes

  • Assuming EBCDIC space is 0x20 like ASCII; in CP037 it's 0x40, a very common off-by-one-table mistake when working with mainframe data.
  • Treating all EBCDIC code pages as identical to CP037; several regional and vendor variants exist with different punctuation byte assignments.

Tips

  • The letter groups (A-I, J-R, S-Z) each start at a byte ending in 1 (C1, D1, E2) and run 9 bytes with no internal gaps, useful for eyeballing whether a byte value looks right.
  • If you need to handle control characters too, treat that as genuinely out of scope for this tool rather than looking for a workaround here.

References

Frequently Asked Questions